@zerodep/is-map
v2.0.11
Published
A utility to determine if a value is a Map
Downloads
24
Readme
@zerodep/is-map
A simple, performant utility to determine if a value is a Map.
Full documentation is available at the zerodep.app page.
Examples
All @zerodep packages support both ESM and CJS.
import { isMap } from '@zerodep/is-map';
// or
const { isMap } = require('@zerodep/is-map');
Positive Response
isMap(new Map()); // true
isMap(
new Map([
['a', 1],
['b', 2],
])
); // true
Negative Response
isMap(['a', 'b', 'c']); // false
isMap(1000n); // false
isMap(true); // false
isMap(new Date()); // false
isMap(''); // false
isMap(new Error('message')); // false
isMap(3.14); // false
isMap(() => 'function'); // false
isMap(42); // false
isMap(null); // false
isMap({ an: 'object' }); // false
isMap(new Promise(() => {})); // false
isMap(/[regex]+/gi); // false
isMap(new Set([1, 2, 3])); // false
isMap('a string'); // false
isMap(Symbol()); // false
isMap(new Int32Array(2)); // false
isMap(undefined); // false