isAsyncIterable.mjs 488 B

12345678910
  1. import { 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. // eslint-disable-next-line no-redeclare
  7. export default function isAsyncIterable(maybeAsyncIterable) {
  8. return typeof (maybeAsyncIterable === null || maybeAsyncIterable === void 0 ? void 0 : maybeAsyncIterable[SYMBOL_ASYNC_ITERATOR]) === 'function';
  9. }