Home

function: flatMapDeep


flatMapDeep(collection: Array, Object, iteratee: function): Array

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

Example(s):

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

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

Params:

Name Type Attribute Description
collection The collection to iterate over.
iteratee The function invoked per iteration.

Returns:

Array

  {
    "comment": "/**\r\n * This method is like `flatMap` except that it recursively flattens the\r\n * mapped results.\r\n *\r\n * @since 4.7.0\r\n * @category Collection\r\n * @param {Array|Object} collection The collection to iterate over.\r\n * @param {Function} iteratee The function invoked per iteration.\r\n * @returns {Array} Returns the new flattened array.\r\n * @see flatMap, flatMapDepth, flatten, flattenDeep, flattenDepth, map, mapKeys, mapValues\r\n * @example\r\n *\r\n * function duplicate(n) {\r\n *   return [[[n, n]]]\r\n * }\r\n *\r\n * flatMapDeep([1, 2], duplicate)\r\n * // => [1, 1, 2, 2]\r\n */",
    "meta": {
        "range": [
            738,
            844
        ],
        "filename": "flatMapDeep.js",
        "lineno": 26,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100002582",
            "name": "flatMapDeep",
            "type": "FunctionDeclaration",
            "paramnames": [
                "collection",
                "iteratee"
            ]
        }
    },
    "description": "This method is like `flatMap` except that it recursively flattens the\rmapped results.",
    "since": "4.7.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Collection",
            "value": "Collection"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "Array",
                    "Object"
                ]
            },
            "description": "The collection to iterate over.",
            "name": "collection"
        },
        {
            "type": {
                "names": [
                    "function"
                ]
            },
            "description": "The function invoked per iteration.",
            "name": "iteratee"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "Returns the new flattened array."
        }
    ],
    "see": [
        "flatMap, flatMapDepth, flatten, flattenDeep, flattenDepth, map, mapKeys, mapValues"
    ],
    "examples": [
        "function duplicate(n) {\r  return [[[n, n]]]\r}\r\rflatMapDeep([1, 2], duplicate)\r// => [1, 1, 2, 2]"
    ],
    "name": "flatMapDeep",
    "longname": "flatMapDeep",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000280",
    "___s": true,
    "filepath": "flatMapDeep.js"
}