flatten_.flatten(array, [shallow]) Flattens a nested array (the nesting can be to any depth). If you pass shallow, the array will only be flattened a single level.
_.flatten([1, [2], [3, [[4]]]]);
=> [1, 2, 3, 4];
_.flatten([1, [2], [3, [[4]]]], true);
=> [1, 2, 3, [[4]]];