@lou.codes/iterables
Version:
🔁 Iterable and AsyncIterable utils
17 lines (16 loc) • 531 B
TypeScript
import type { IsomorphicIterable } from "@lou.codes/types";
/**
* Returns a single instance of each item in the iterable or asynchronous
* iterable.
*
* @category Asynchronous Generators
* @example
* ```typescript
* unique([1, 2, 3, 4, 1, 2, 3, 4]); // [1, 2, 3, 4]
* ```
* @param iterable Iterable to be filtered.
* @returns Generators with a single instance of each item of the iterable.
*/
export declare const unique: <Item>(
iterable: IsomorphicIterable<Item>,
) => Readonly<AsyncIterableIterator<Awaited<Item>>>;