Files
AmirAli 0108a31e9a extra data (#55)
* added: group, wxpos (wide x position), wypos(wide y position), block

* update: README.md
2022-12-22 16:29:27 -05:00

21 lines
557 B
JavaScript

const fs = require('fs');
const json = fs.readFileSync('../PeriodicTableJSON.json');
const Periodic = JSON.parse(json).elements;
const lookup = Periodic.reduce((acc, curr) => {
const name = curr.name.toLowerCase();
acc.order.push(name);
acc[name] = curr;
return acc;
}, { order: [] });
if(!!lookup.order.length) {
fs.writeFile('../periodic-table-lookup.json', JSON.stringify(lookup, null, 4), () => {
console.log('Periodic lookup successfully created');
})
} else {
throw new Error('Problem creating lookup file');
}