Created
April 11, 2013 19:52
-
-
Save mikemorris/5366632 to your computer and use it in GitHub Desktop.
return length of piped JSON array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var buffer = ''; | |
process.stdin.on('data', function(data) { | |
buffer += data; | |
}); | |
process.stdin.on('end', function() { | |
console.log(Array.prototype.slice.call(JSON.parse(buffer.toString())).length); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why are you using
Array.prototype.slice
? Just curious