Removes objects from the array which the value of its specifed key included before by another
Example:
import { uniquifyByKey } "@thalesrc/js-utils/array"; const array = [{a: 1}, {a: 1}, {a: 2}, {a: 3}, {a: 3}, {a: 4}]; uniquifyByKey(array, 'a'); // [{a: 1}, {a: 2}, {a: 3}, {a: 4}]
Prototype Example:
import "@thalesrc/js-utils/array/proto/uniquify-by-key"; const array = [{a: 1}, {a: 1}, {a: 2}, {a: 3}, {a: 3}, {a: 4}]; array.uniquifyByKey('a'); // [{a: 1}, {a: 2}, {a: 3}, {a: 4}]
Collection of the objects
Key to search the value on
The new uniquified array
Generated using TypeDoc
Uniquify By Key
Removes objects from the array which the value of its specifed key included before by another
Example:
import { uniquifyByKey } "@thalesrc/js-utils/array"; const array = [{a: 1}, {a: 1}, {a: 2}, {a: 3}, {a: 3}, {a: 4}]; uniquifyByKey(array, 'a'); // [{a: 1}, {a: 2}, {a: 3}, {a: 4}]
Prototype Example:
import "@thalesrc/js-utils/array/proto/uniquify-by-key"; const array = [{a: 1}, {a: 1}, {a: 2}, {a: 3}, {a: 3}, {a: 4}]; array.uniquifyByKey('a'); // [{a: 1}, {a: 2}, {a: 3}, {a: 4}]