Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/isx/object/is_async_iterable.ts>isAsyncIterable

Collection of validation functions for JavaScript data
Latest
function isAsyncIterable
import { isAsyncIterable } from "https://deno.land/x/isx@1.5.0/object/is_async_iterable.ts";

Whether the input is AsyncIterable or not.

Examples

Example 1

import { isAsyncIterable } from "https://deno.land/x/isx@$VERSION/object/is_async_iterable.ts"
import { assertEquals } from "https://deno.land/std/testing/asserts.ts"
assertEquals(
  isAsyncIterable({
    async *[Symbol.asyncIterator]() {
      yield "hello";
    },
  }),
  true,
);
assertEquals(isAsyncIterable({}), false);

Parameters

input: Readonly<{ [[Symbol.asyncIterator]]?: unknown; }>
  • Any object.

Returns

input is AsyncIterable<unknown>