underscore-cli
underscore-cli copied to clipboard
add first/last/groupBy
cat json.json | underscore first 50
`cat json.json | underscore groupBy id'
:)
i'm finding myself doing this quite a bit too...
it would be cool if you could make it easy for us to add our own commands/mixins
underscore process 'groupBy(data,"LocationName")' | underscore values | underscore map 'extend.apply(null,value,{})'
It is not exactly what you ask here, namely custom commands...
However, to get the first 50 items from a list:
< json.json underscore filter 'key < 50'
And if you want to have the one with index 50:
< json.json underscore find 'key >= 50'
This is only for arrays of course...