isAsyncIterable.mjs 363 B

1234567891011
  1. /**
  2. * Returns true if the provided object implements the AsyncIterator protocol via
  3. * implementing a `Symbol.asyncIterator` method.
  4. */
  5. export function isAsyncIterable(maybeAsyncIterable) {
  6. return (
  7. typeof (maybeAsyncIterable === null || maybeAsyncIterable === void 0
  8. ? void 0
  9. : maybeAsyncIterable[Symbol.asyncIterator]) === 'function'
  10. );
  11. }