-
-
Notifications
You must be signed in to change notification settings - Fork 0
async iterable iterator
Nicholas Berlette edited this page Jun 19, 2025
·
1 revision
function isAsyncIterableIterator<T>(
it: unknown,
): it is AsyncIterableIterator<T>;
Checks if a value is an AsyncIterableIterator
, which is an AsyncIterator
with a Symbol.asyncIterator
method that returns a reference to itself.
Name | Info |
---|---|
it |
The value to check. |
true
if the value is an AsyncIterableIterator
, false
otherwise.
Iterables
import isAsyncIterableIterator from "jsr:@nick/is/async-iterable-iterator";
const iter = (async function* () {
yield 1;
})();
console.log(isAsyncIterableIterator(iter)); // true
console.log(isAsyncIterableIterator(iter[Symbol.asyncIterator]())); // true