UNPKG

@lou.codes/iterables

Version:
19 lines (18 loc) 485 B
import type { Numeric, ReadOnlyIterable } from "@lou.codes/types"; /** * Take the given amount of items from the iterable. * * @category Generators * @example * ```typescript * const take2 = take(2); * take2([1, 2, 3, 4, 5]); // [1, 2] * ``` * @param amount Amount of items to take. * @returns Curried function with `amount` in context. */ export declare const take: ( amount: Numeric, ) => <Item>( iterable: ReadOnlyIterable<Item>, ) => Readonly<IterableIterator<Item>>;