Deduplicate the values in an array using a specified key function. Preserves order.
const animals = [ { id: 1, animal: 'whale' }, { id: 1, animal: 'gorilla' }, { id: 2, animal: 'ant' },]dedupArrayBy(animals, animal => animal.id) === [ { id: 1, animal: 'whale' }, { id: 2, animal: 'ant' },]
the array to deduplicate
a function to generate a key to dedup by
Generated using TypeDoc
Deduplicate the values in an array using a specified key function. Preserves order.
Example