1
0
Fork 0
mirror of https://github.com/Findus23/RainbowRoad.git synced 2024-09-19 16:03:52 +02:00
RainbowRoad/commands/stats.ts
2022-12-11 20:47:19 +01:00

19 lines
452 B
TypeScript

import * as fs from "fs";
import type {Crossing} from "../interfaces";
function runstats() {
const data: Crossing[] = JSON.parse(fs.readFileSync("../data/Wien.json", 'utf8'));
console.log("total", data.length)
const bezirke = data.map(c => c.bezirk!)
const counts: { [key: number]: number } = {};
for (const num of bezirke) {
counts[num] = counts[num] ? counts[num] + 1 : 1;
}
console.log(counts)
}
runstats()