How can I union arrays inside an array using lodash?
For example:
Input:
var x = [ [1,2,3,4], [5,6,7], [], [8,9], [] ];Expected output:
x = [1,2,3,4,5,6,7,8,9];
Currently my code does the following:
return promise.map(someObjects, function (object)) {
return anArrayOfElements();
}).then(function (arrayOfArrayElements) {
// I tried to use union but it can apply only on two arrays
_.union(arrayOfArrayElements);
});
_.flatten?