4.17.11
3.10.1
2.4.2
1.3.1

_.flatMapDeep(collection, [iteratee=_.identity])

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

Since

4.7.0

Arguments

argument
collection
[iteratee=_.identity]
type
(Array|Object)
Function
description
The collection to iterate over.
The function invoked per iteration.

Returns

(array)

Example

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

_.flatMapDeep([1, 2], duplicate);
// => [1, 1, 2, 2]
function duplicate(n) {
  return [[[n, n]]];
}

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