Skip to content

Commit

Permalink
Updates readme examples
Browse files Browse the repository at this point in the history
  • Loading branch information
braposo committed Jun 28, 2020
1 parent fb0fa2f commit bd6d8ae
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ A tiny (< 1KB) utility library that transforms the Figma API response into somet
import processFile from 'figma-transformer';

// Fetch the file you want using your favourite method
...
const originalFile = fetchFigmaFile();

const fileData = processFile(originalFile);
const file = processFile(originalFile);

// ✨ You can now use `fileData` for whatever you need! ✨
// ✨ You can now use `file` for whatever you need! ✨

// Let's get the styles for a component named "Test"
const testStyles = data.shortcuts.components
const testStyles = file.shortcuts.components
.find(component => component.name === "Test")
.shortcuts.styles;

Expand Down Expand Up @@ -255,21 +255,21 @@ Let's see more specific examples where the benefits of the library really stand
**Getting all text used in a document**

```js
const text = data.shortcuts.texts.map(node => node.characters);
const text = file.shortcuts.texts.map(node => node.characters);
```

**Finding the styles applied to a specific component**

```js
const styles = data.shortcuts.components
const styles = file.shortcuts.components
.filter(component => component.name === "Test")
.map(component => component.shortcuts.styles);
```

**Getting the fill colours for all the rectangles in the first page**

```js
const fills = data.shortcuts.pages
const fills = file.shortcuts.pages
.filter(page => page.name === "Page 1")
.map(page => page.shortcuts.rectangles.fills);
```
Expand Down

0 comments on commit bd6d8ae

Please sign in to comment.