blob: e81f94eaff51fe459f63981c6b378e78a7d6bb6a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
// @flow strict
import { SYMBOL_ASYNC_ITERATOR } from '../polyfills/symbols';
/**
* Returns true if the provided object implements the AsyncIterator protocol via
* either implementing a `Symbol.asyncIterator` or `"@@asyncIterator"` method.
*/
declare function isAsyncIterable(value: mixed): boolean %checks(value instanceof
AsyncIterable);
// eslint-disable-next-line no-redeclare
export default function isAsyncIterable(maybeAsyncIterable) {
return typeof maybeAsyncIterable?.[SYMBOL_ASYNC_ITERATOR] === 'function';
}
|