underscore-cli icon indicating copy to clipboard operation
underscore-cli copied to clipboard

add first/last/groupBy

Open boxxxie opened this issue 11 years ago • 1 comments

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,{})'

boxxxie avatar Apr 05 '13 22:04 boxxxie

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...

mrquincle avatar Mar 18 '14 14:03 mrquincle