Like _.flatMap, but recursively flattens all nesting in the mapped results. Same idea as map + _.flattenDeep. Part of Lodash 4.x Collection (since 4.7.0).
Pass the required arguments shown below. Lodash Collection helpers usually return a new value — check whether the source is mutated.
Syntax
Call _.flatMapDeep on a collection. Start with this line.
Lodash
_.flatMapDeep(collection, [iteratee=_.identity])
Call
What it does
_.flatMapDeep(collection, [iteratee=_.identity])
Primary signature.
_.flatMapDeep(collection)
Call with a collection argument.
Prefer import flatMapDeep from "lodash/flatMapDeep" when you want a smaller bundle.
Even. Returns [[[n, n*10]]] → deep-unwrapped to two leaves.
Mix. Scalars and nested arrays can share one call.
Guard. Objects (non-arrays) are leaves too — they are not walked.
Compatibility
Browser & Runtime Support
_.flatMapDeep is a Lodash 4.x Collection helper (added in 4.7.0). It runs anywhere Lodash 4.7+ runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Native Array.flatMap only flattens one level.
✓ Stable · Lodash 4.7+
_.flatMapDeep()
Available in [email protected]+ full builds and the lodash/flatMapDeep modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.
100%With Lodash 4.7+
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.flatMapDeepLodash 4.7+
Bottom line: Safe for production on Lodash 4.7+. Prefer import flatMapDeep from "lodash/flatMapDeep" for smaller builds. There is no native recursive flatMap — use Lodash or map + flat(Infinity).
Frequently Asked Questions
_.flatMapDeep(collection, iteratee) maps each element through iteratee, then recursively flattens all nested arrays in the results into one flat array.
No. It returns a new array. The source collection is left unchanged.
_.flatMap flattens only one level after mapping. _.flatMapDeep keeps flattening until no nested arrays remain.
Use _.flatMapDepth when you know a maximum depth and want to avoid fully collapsing very deep structures.
Scalars and objects are appended as single items. Only arrays are flattened recursively.
_.flatMapDeep was added in Lodash 4.7.0. It is stable in Lodash 4.x.