Creates a duplicate-free version of an array, it accepts comparator which is invoked to compare elements of array
uniqWith( [{ x: 1, y: 2 }, { x: 1, y: 3 }, { x: 2, y: 4 }, { x: 1, y: 2 }], (arrayValue, otherValue) => arrayValue.x === otherValue.x ); // returns [{ x: 1, y: 2 }, { x: 2, y: 4 }]
unique array
Generated using TypeDoc
Creates a duplicate-free version of an array, it accepts comparator which is invoked to compare elements of array
uniqWith( [{ x: 1, y: 2 }, { x: 1, y: 3 }, { x: 2, y: 4 }, { x: 1, y: 2 }], (arrayValue, otherValue) => arrayValue.x === otherValue.x ); // returns [{ x: 1, y: 2 }, { x: 2, y: 4 }]