UNPKG

@naturalcycles/js-lib

Version:

Standard library for universal (browser + Node.js) javascript

28 lines (27 loc) 1.22 kB
import type { AbortableAsyncMapper, AbortableAsyncPredicate, Promisable } from '../types.js'; import { END } from '../types.js'; /** * Similar to Iterable2, but for AsyncIterable. * * AsyncIterable2 is a wrapper around AsyncIterable that implements "Iterator Helpers proposal": * https://github.com/tc39/proposal-iterator-helpers * * AsyncIterable2 can be removed after the proposal is widely implemented in Node & browsers. * * @experimental */ export declare class AsyncIterable2<T> implements AsyncIterable<T> { private it; private constructor(); static of<T>(it: AsyncIterable<T>): AsyncIterable2<T>; static ofIterable<T>(it: Iterable<T>): AsyncIterable2<T>; static empty<T>(): AsyncIterable2<T>; [Symbol.asyncIterator](): AsyncIterator<T>; toArray(): Promise<T[]>; forEach(cb: (v: T, i: number) => Promisable<any | typeof END>): Promise<void>; some(cb: AbortableAsyncPredicate<T>): Promise<boolean>; every(cb: AbortableAsyncPredicate<T>): Promise<boolean>; find(cb: AbortableAsyncPredicate<T>): Promise<T | undefined>; filter(cb: AbortableAsyncPredicate<T>): AsyncIterable2<T>; map<OUT>(mapper: AbortableAsyncMapper<T, OUT>): AsyncIterable2<OUT>; }