@monstermann/fn
Version:
A utility library for TypeScript.
22 lines • 507 B
TypeScript
//#region src/array/unique.d.ts
/**
* `unique(target)`
*
* Returns a new array with only the unique elements from `target`, preserving the order of first occurrence.
*
* ```ts
* unique([1, 2, 2, 3, 1]); // [1, 2, 3]
* ```
*
* ```ts
* pipe([1, 2, 2, 3, 1], unique()); // [1, 2, 3]
* ```
*/
declare const unique: {
(): <T>(target: T[]) => T[];
(): <T>(target: readonly T[]) => readonly T[];
<T>(target: T[]): T[];
<T>(target: readonly T[]): readonly T[];
};
//#endregion
export { unique };