Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
r.c = rows.filter(function(s){
return s.parent_id == r.i;
}).map(simplify);
if(r.c.length == 0) delete r.c;
return r;
});
fs.writeFileSync('json/'+p.id+'.json', JSON.stringify(regions));
});
fs.writeFileSync('json/last-updated-at', new Date().toString());
console.log("data dumping ok.\n");
}
var sqlite3 = require('sqlite3'), db;
db = new sqlite3.Database(db_file, sqlite3.READ_ONLY);
db.all("select * from `regions` order by `id` ASC", dump);
db.close();
})('regions.db');