uniq multimethod
Methods
- uniq(e:Eachable1, cb:Fun=method) Source: stdlib.ngs:3162
Return unique values. Warning: uses Hash so comparison is not using == but a built-in hash keys comparison. Returns
Of same type as eExample
[1,2,2,3,4,4].uniq() # [1,2,3,4] [{"a": 1, "z": 10}, {"a": 1, "z": 20}, {"a": 2, "z": 30}].uniq(X.a) # [{"a": 1, "z": 10}, {"a": 2, "z": 30}]
- uniq(e:Eachable1, field:Str) Source: stdlib.ngs:3183
Return unique values. Warning: uses Hash so comparison is not using == but a built-in hash keys comparison. Returns
Of same type as eExample
[{"id": 100, "a": 1}, {"id": 200, "a": 2}, {"id": 300, "a": 2}].uniq("a") # [{"id": 100, "a": 1}, {"id": 200, "a": 2}]