# \_.flatMapDepth(collection, iteratee=_.identity , depth=1 )

URL: https://caijiao.org/lodash/docs/Collection/_.flatMapDepth
Source: docs/lodash/docs/Collection/_.flatMapDepth.md
Description: _.flatMapDepth(collection, [iteratee=_.identity], [depth=1]) 用于对集合中的每个元素应用一个函数，并指定扁平化的深度。

`_.flatMapDepth(collection, [iteratee=_.identity], [depth=1])` 用于对集合中的每个元素应用一个函数，并指定扁平化的深度。

- `collection`：要处理的集合，可以是数组、对象或类数组对象。
- `iteratee`（可选）：应用于每个元素的函数，默认为 `_.identity` 函数。
- `depth`（可选）：指定扁平化的深度，默认为 `1`。

应用举例：

```javascript
// 原始集合
const collection = [
  [1, 2],
  [3, [4]],
  [5, 6],
];

// 对每个元素应用函数并指定扁平化深度为 1
const result = _.flatMapDepth(collection, (value) => value, 1);

console.log(result);
// 输出：[1, 2, 3, [4], 5, 6]
```

在这个例子中，`_.flatMapDepth` 方法对原始集合中的每个元素应用了一个函数，并指定了扁平化的深度为 `1`，所以只有一层的嵌套数组被展开，而深度大于 `1` 的嵌套数组保持不变。
