Only returns unique elements. It works with a simple compare, so ok for simple types like
numbers and strings, but for objects it will work on the reference. If you need something
more sophisticated, uniqBy(...) is propably what you need.
Beware: all unique elements need to fit in memory to keep track of the ones that we already
have seen!
Only returns unique elements. It works with a simple compare, so ok for simple types like numbers and strings, but for objects it will work on the reference. If you need something more sophisticated,
uniqBy(...)
is propably what you need.Beware: all unique elements need to fit in memory to keep track of the ones that we already have seen!
Example