Add script to count json objects
This commit is contained in:
7
.bin/count-json-objects.js
Executable file
7
.bin/count-json-objects.js
Executable 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)))))
|
||||||
Reference in New Issue
Block a user