UNPKG

488 BJavaScriptView Raw
1import { SYMBOL_ASYNC_ITERATOR } from "../polyfills/symbols.mjs";
2/**
3 * Returns true if the provided object implements the AsyncIterator protocol via
4 * either implementing a `Symbol.asyncIterator` or `"@@asyncIterator"` method.
5 */
6
7// eslint-disable-next-line no-redeclare
8export default function isAsyncIterable(maybeAsyncIterable) {
9 return typeof (maybeAsyncIterable === null || maybeAsyncIterable === void 0 ? void 0 : maybeAsyncIterable[SYMBOL_ASYNC_ITERATOR]) === 'function';
10}