数组对象根据某一个值去重
let arr = [{name:'l',id:1},{name:'li',id:2},{name:'le',id:3},{name:'lw',id:1},]
console.log(this._.uniqBy(arr, 'id'))
//[{name:'l',id:1},{name:'li',id:2},{name:'le',id:3}]
数组去重
this._.uniq([2, 1, 2]);
// => [2, 1]
两个数组对象对比根据某一个值去重
let newArr = this._.differenceBy(
[
{ name: "a", age: 12 },
{ name: "b", age: 18 },
{ name: "c", age: 18 }
],
[
{ name: "a", age: 14 },
{ name: "c", age: 18 }
],
"name"
);
console.log(newArr);
//[{ name: "b", age: 18 },]
若干数组并集,交集,补集
var a = [];
var b = [];
var c = [];
_.union(a, b, c);
_.intersection(a, b, c);
_.xor(a, b);
陆续更新