Skip to content

Commit

Permalink
Add example code for TokensWalker in Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
salamaashoush committed Nov 28, 2023
1 parent 2ef8823 commit a7a0725
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions packages/w3c-dtfm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,26 @@ bun install @design-sync/w3c-dtfm
Import:

```js
// ESM
import {} from "@design-sync/w3c-dtfm";

// CommonJS
const {} = require("@design-sync/w3c-dtfm");
import { TokensWalker } from "@design-sync/w3c-dtfm";

const tokens = {
"color": {
"primary": {
"$value": "#000000",
"$type": "color"
}
}
... // rest of tokens
};
const walker = new TokensWalker(tokens);

walker.walk((token) => {
// do something with token
console.log(token);
});
```


## Development

- Clone this repository
Expand Down

0 comments on commit a7a0725

Please sign in to comment.