const _ = require('lodash');
let a = [{b:4,c:2},{b: 2, c:3},{b: 1, c:1}]
const removeDuplicates = function(a,targ) {
console.log(_.sortBy(a, function(it) {
return it.c //参数为需要排序的
}));
}
console.log(removeDuplicates(a,targ))
以上为a数组的c参数排序
结果为
[ { b: 1, c: 1 }, { b: 4, c: 2 }, { b: 2, c: 3 } ]