reindexio / youmightnotneedunderscore

https://www.reindex.io/blog/you-might-not-need-underscore/
MIT License
226 stars 18 forks source link

Alternative to _.union(*arrays) #22

Open mems opened 8 years ago

mems commented 8 years ago
[...new Set(arrays[0].concat(arrays[1], arrays[2]))]

Example, for:

_.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
=> [1, 2, 3, 101, 10]

Gives:

[...new Set([1, 2, 3].concat([101, 2, 1, 10], [2, 1]))]
=> [1, 2, 3, 101, 10]