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