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