Skip to main content

flatMapDeep

_.flatMapDeep(iteratee, collection) # Ⓢ [Ⓣ][1] Ⓝ

This method is like _.flatMap except that it recursively flattens the



mapped results.

Since​

4.7.0

Arguments​

  1. iteratee (Function): The function invoked per iteration.
  2. collection (Array|Object): The collection to iterate over.

Returns​

(Array): Returns the new flattened array.

Example​

function duplicate(n) {
return [[[n, n]]];
}

_.flatMapDeep(duplicate, [1, 2]);
// => [1, 1, 2, 2]