Sha256: 7e202e256dc7578654e18c80e030fdaa3c18789b75b58e1f2434b17e774bd03b
Contents?: true
Size: 879 Bytes
Versions: 26
Compression:
Stored size: 879 Bytes
Contents
/** * This is the same as TypeScript's `Iterable`, but with all three type parameters. * @todo Remove once TypeScript 5.6 is the minimum. */ export interface Iterable<T, TReturn, TNext> { [Symbol.iterator](): Iterator<T, TReturn, TNext> } /** * This is the same as TypeScript's `AsyncIterable`, but with all three type parameters. * @todo Remove once TypeScript 5.6 is the minimum. */ export interface AsyncIterable<T, TReturn, TNext> { [Symbol.asyncIterator](): AsyncIterator<T, TReturn, TNext> } /** * Determines if the given function is an iterator. */ export function isIterable<IteratorType>( fn: any, ): fn is | Iterable<IteratorType, IteratorType, IteratorType> | AsyncIterable<IteratorType, IteratorType, IteratorType> { if (!fn) { return false } return ( Reflect.has(fn, Symbol.iterator) || Reflect.has(fn, Symbol.asyncIterator) ) }
Version data entries
26 entries across 26 versions & 1 rubygems