From 4e3c25e3eded65b74a76eb4713c2e3378369563c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Valderrama?= Date: Mon, 4 Mar 2024 10:48:15 +0100 Subject: [PATCH] feat: plugins-data-parser readme --- libs/plugins-data-parser/README.md | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/libs/plugins-data-parser/README.md b/libs/plugins-data-parser/README.md index cedc3bd..3e50103 100644 --- a/libs/plugins-data-parser/README.md +++ b/libs/plugins-data-parser/README.md @@ -1,7 +1,24 @@ -# plugins-data-parser +# Parser -This library was generated with [Nx](https://nx.dev). +This library includes a `parse()` funtion and some parsed models like `ParsedFile` or `ParsedPage`. -## Building +The parse function cleans up and transforms a penpot object into a more typescript friendly object. It returns a `ParsedData` object that can be casted as `ParsedFile` or `ParsedPage`. Note that `ParsedData` is the parent interface and includes all `ParsedFile` and `ParsedPage` properties. -Run `nx build plugins-data-parser` to build the library. +Most of the properties are optional and may or may not be present in your result, you should access them with care. + +## Use + +Import the parse function and the desired models from plugins data parser. + +Example: + +``` +import { parse, ParsedFile } from 'plugins-parser'; + +[...] + +const parsedFile: ParsedFile = parse(file); +console.log(parsedFile.data.colors?.[0]?.data?.color); + +[...] +```