I dig it too, but you could previously flatten an array with concat, and the spread operator. [].concat(...array)
Lodash wasn't necessary.
Lodash wasn't necessary.
In general the spread operator should only be used for forwarding arguments not for array operations.
Not quite. You should also use the spread operator when you are spreading an iterable into an array:
const unique = [...new Set(arr)]; const unique = [...a, ...b];
You might expect that concat would work, but it doesn't handle arbitrary iterables: > [].concat([1][Symbol.iterator](), [2][Symbol.iterator]())
[Array Iterator, Array Iterator]
> [...[1][Symbol.iterator](), ...[2][Symbol.iterator]()]
[1, 2]Much rather have the magic word “flat”