-
-
Notifications
You must be signed in to change notification settings - Fork 0
set iterator
Nicholas Berlette edited this page Jun 19, 2025
·
1 revision
function isSetIterator<T>(it: unknown): it is SetIterator<T>;
Check if the given value is a set iterator, which is an iterable iterator that
yields key-value pairs from a Set object. This is the type of object returned by
the Set.prototype.entries
and Set.prototype[Symbol.iterator]
methods.
Name | Info |
---|---|
it |
The value to check. |
true
if the value is a set iterator, false
otherwise.
Iterables
import { isSetIterator } from "jsr:@nick/is/set-iterator";
const set = new Set(["foo", "bar", "foo"]);
const iter = set[Symbol.iterator]();
console.log(isSetIterator(iterator)); // true
console.log(isSetIterator(set)); // false
Represents a set iterator.
-
T
(default:unknown
)
readonly [Symbol.toStringTag]: "Set Iterator" | "Set Entries";