AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
## unionBy + [link](./unionBy "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L6807 "View in source.") + [npm](https://www.npmjs.com/package/lodash.unionby "See the npm package.") ``` _.unionBy([arrays], [iteratee=_.identity]) ``` 这个方法类似 `_.union`,除了它接受一个 iteratee 调用每一个数组和值。iteratee 会传入一个参数:(value)。 ### 参数 1. [arrays] (...Array) 需要处理的数组队列 2. [iteratee=_.identity] (Function|Object|string) 这个函数会处理每一个元素 ### 返回值 (Array) 返回处理好的数组 ### 示例 ``` _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor); // => [2.1, 1.2, 4.3] // 使用了 `_.property` 的回调结果 _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); // => [{ 'x': 1 }, { 'x': 2 }] ```