Add script to count json objects

master
Hektor Misplon 2021-09-28 16:22:21 +02:00
parent 07fbefb40e
commit fdf721c2b6
1 changed files with 7 additions and 0 deletions

7
.bin/count-json-objects.js Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env node
const fs = require('fs')
const objLength = obj => Object.keys(obj).length
fs.readFile(process.argv[2], (err, data) => (err ? console.error(err) : console.log(objLength(JSON.parse(data)))))