用AI赚第一桶💰低成本搭建一套AI赚钱工具,源码可二开。 广告
## uniqBy + [link](./uniqBy "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L6878 "View in source.") + [npm](https://www.npmjs.com/package/lodash.uniqby "See the npm package.") ``` _.uniqBy(array, [iteratee=_.identity]) ``` 这个方法类似 `_.uniq`,除了它接受一个 iteratee 调用每一个数组和值来计算唯一性。iteratee 会传入一个参数:(value)。 ### 参数 1. array (Array) 需要处理的数组 2. [iteratee=_.identity] (Function|Object|string) 这个函数会处理每一个元素 ### 返回值 (Array) 返回不重复的数组 ### 示例 ``` _.uniqBy([2.1, 1.2, 2.3], Math.floor); // => [2.1, 1.2] // 使用了 `_.property` 的回调结果 _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); // => [{ 'x': 1 }, { 'x': 2 }] ```