daily pastebin goal
34%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // input file dico.json output file data.json
  2. var arr;
  3. var fs = require('fs');
  4. fs.readFile('dico.json',function(err,content){fs.writeFile("data.json",JSON.stringify({'word':cleanArray(JSON.parse(content).words)}),function(err){if(err){ throw err;};});})
  5.  
  6. function cleanArray(arra) {
  7.    var i, j, len = arra.length, out = [], obj = {};
  8.    for (i = 0; i < len; i++) {
  9.      obj[arra[i]] = 0;
  10.    }
  11.    for (j in obj) {
  12.      out.push(j);
  13.    }
  14.    return out;
  15.  }
RAW Paste Data
Top