@lou.codes/iterables
Version:
🔁 Iterable and AsyncIterable utils
20 lines (19 loc) • 579 B
TypeScript
import type {
IsomorphicIterable,
IsomorphicIterableItem,
IsomorphicIterableIterator,
} from "@lou.codes/types";
/**
* Get all elements except the last one of an iterable or asynchronous iterable.
*
* @category Asynchronous Generators
* @example
* ```typescript
* initial([1, 2, 3]); // [1, 2]
* ```
* @param iterable Iterable to get the items from.
* @returns Iterable with all items except the last one.
*/
export declare const initial: <Iterable extends IsomorphicIterable>(
iterable: Iterable,
) => IsomorphicIterableIterator<IsomorphicIterableItem<Iterable>>;