Skip to content

Commit

Permalink
feat: write json files
Browse files Browse the repository at this point in the history
  • Loading branch information
feerglas committed Aug 19, 2020
1 parent 89c3134 commit 4c49c3b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions figmaExtractor/figmaWriteJson.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const fs = require('fs');

module.exports = (json) => {

// make sure directory is there
if (!fs.existsSync('./properties')) {
fs.mkdirSync('./properties');
}

// the main keys in the object are used as
// file names for the json files
const keys = Object.keys(json);

keys.forEach((key) => {
const content = json[key];

fs.writeFileSync(`./properties/${key}.json`, JSON.stringify(content));
});

}

0 comments on commit 4c49c3b

Please sign in to comment.