mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
16 lines
519 B
TypeScript
16 lines
519 B
TypeScript
//#region src/array/uniq-by.d.ts
|
|
/**
|
|
* Returns array with duplicates removed, keeping the LAST occurrence.
|
|
* Useful for feature merging where extensions should override base features.
|
|
*
|
|
* @example
|
|
* ```ts
|
|
* const features = [{ id: 'a', v: 1 }, { id: 'b', v: 2 }, { id: 'a', v: 3 }];
|
|
* uniqBy(features, s => s.id);
|
|
* // => [{ id: 'b', v: 2 }, { id: 'a', v: 3 }]
|
|
* ```
|
|
*/
|
|
declare function uniqBy<T, K>(arr: T[], mapper: (item: T) => K): T[];
|
|
//#endregion
|
|
export { uniqBy };
|
|
//# sourceMappingURL=uniq-by.d.ts.map
|