1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

Added unique_by function

This commit is contained in:
Santiago Lapresta
2014-05-12 01:37:27 +02:00
parent 022a418894
commit 41a093c1f2
2 changed files with 16 additions and 0 deletions

View File

@@ -931,6 +931,21 @@ sections:
input: '[1,2,5,3,5,3,1,3]'
output: ['[1,2,3,5]']
- title: `unique_by`
body: |
The `unique_by(.foo)` function takes as input an array and produces
an array of the same elements, in sorted order, with
elqements with a duplicate `.foo` field removed. Think of it as making
an array by taking one element out of every group produced by
`group_by`.
examples:
- program: 'unique'
input: '[1,2,5,3,5,3,1,3]'
output: ['[1,2,3,5]']
- title: `reverse`
body: |