UNPKG

@lou.codes/iterables

Version:
21 lines (20 loc) 742 B
import type { IsomorphicIterable } from "@lou.codes/types"; /** * Appends one iterable or asynchronous iterable to another. * * @category Asynchronous Generators * @example * ```typescript * const appendNumbers = append([0, 1, 2, 3, 4]); * * appendNumbers(["foo", "bar"]); // ["foo", "bar", 0, 1, 2, 3, 4] * appendNumbers([]); // [0, 1, 2, 3, 4] * ``` * @param tailIterable Iterable or asynchronous to be appended. * @returns Curried generator function with `tailIterable` set in context. */ export declare const append: <TailItem>( tailIterable: IsomorphicIterable<TailItem>, ) => <InitialItem>( initialIterable: IsomorphicIterable<InitialItem>, ) => Readonly<AsyncIterableIterator<Awaited<InitialItem> | Awaited<TailItem>>>;