UNPKG

@lou.codes/iterables

Version:
22 lines (21 loc) 653 B
import type { ReadOnlyIterable, ReadOnlyIterableIterator, } from "@lou.codes/types"; /** * Prepends one iterable to another. * * @category Generators * @example * ```typescript * const prependNumbers = prepend([0, 1, 2, 3, 4]); * prependNumbers(["foo", "bar"]); // [0, 1, 2, 3, 4, "foo", "bar"] * ``` * @param initialIterable Iterable to be appended. * @returns Curried generator function with `initialIterable` set in context. */ export declare const prepend: <InitialItem>( initialIterable: ReadOnlyIterable<InitialItem>, ) => <TailItem>( tailIterable: ReadOnlyIterable<TailItem>, ) => ReadOnlyIterableIterator<InitialItem | TailItem>;