UNPKG

stream-chain

Version:

Chain functions, generators, Node streams, and Web streams into a pipeline with backpressure support.

16 lines (13 loc) 549 B
import {none, stop} from '../defs.js'; /** * Creates a function that takes `n` elements. * @param n number of elements * @param finalValue a value that is returned when `n` elements are taken. It can be {@link none} or {@link stop}. It defaults to {@link none}. * @returns a function that takes a value and returns a value or {@link finalValue} when `n` elements are taken */ declare function take<T = unknown>( n: number, finalValue?: typeof none | typeof stop ): (value: T) => T | typeof finalValue; export default take; export {take};