ts-prime
Version:
A utility library for JavaScript and Typescript.
25 lines • 859 B
TypeScript
import { LazyResult } from './_reduceLazy';
/**
* Returns a new array containing only one copy of each element in the original list.
* Elements are compared by reference using Set.
* Note: In `pipe`, use `uniq()` form instead of `uniq`. Otherwise, the inferred type is lost.
* @param array - List of items
* @signature
* P.uniq(array)
* @signature
* P.pipe(array, P.uniq())
* @example
* P.uniq([1, 2, 2, 5, 1, 6, 7]) // => [1, 2, 5, 6, 7]
* P.pipe(
* [1, 2, 2, 5, 1, 6, 7], // only 4 iterations
* P.uniq(),
* P.take(3)
* ) // => [1, 2, 5]
* @category Array, Pipe
*/
export declare function uniq<T>(array: readonly T[]): T[];
export declare function uniq<T>(): (array: readonly T[]) => T[];
export declare namespace uniq {
function lazy(): (value: any) => LazyResult<any>;
}
//# sourceMappingURL=uniq.d.ts.map