UNPKG

@lou.codes/iterables

Version:
20 lines (19 loc) 579 B
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>>;