UNPKG

asyncerator

Version:

Provide supporting types for AsyncIterable/AsyncIterableIterators, promisified stream.pipeline implementation, and Array-like utility operators, sources and sinks.

11 lines (10 loc) 594 B
import type { Operator } from './index'; /** * The sequenceFunction will be called repeatedly with an incrementing numerical parameter, returning a Promise * that resolves with the same type as Input and is inserted into the stream. The sequence operator * passes through all other values. Because the sequenceFunction returns a Promise, it * can delay its response (using setTimeout) to emit values on a regular schedule, e.g., once a second. * * @param sequenceFunction */ export default function <Input>(sequenceFunction: (index: number) => Promise<Input>): Operator<Input, Input>;