let objects = [ { x: 1, y: 2, z: 1 }, { x: 2, y: 1, z: 2 }, { x: 1, y: 2, z: 3 }, ]; function uniqFn(array, keysList) { return _.uniqWith(array, function (arrVal, othVal) { return keysList.reduce((acc, cur, idx) => { return acc && arrVal[cur] === othVal[cur]; }, true); }); } console.log(uniqFn(objects, ["x", "y"]))