oeffisearch/ds100.js
2020-06-12 14:49:54 +00:00

23 lines
583 B
JavaScript

const stations = require('db-stations')
const fs = require('fs');
var ds100list = {};
var ds100reverseList = {};
stations.full()
.on('data',function(station){
var stuff = [];
station.ril100Identifiers.forEach(element => {
stuff.push(element.rilIdentifier)
ds100reverseList[element.rilIdentifier] = station.id;
})
if (stuff.length === 0) return;
ds100list[station.id] = stuff.join(', ');
})
.on('end',function(){
fs.writeFile("ds100.json", JSON.stringify(ds100list), () => {});
fs.writeFile("ds100reverse.json", JSON.stringify(ds100reverseList), () => {});
});