@zerodep/is-map
TypeScript icon, indicating that this package has built-in type declarations

2.0.7 • Public • Published

@zerodep/is-map

version language types license

CodeFactor Known Vulnerabilities

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

/@zerodep/is-map/

    Package Sidebar

    Install

    npm i @zerodep/is-map

    Homepage

    zerodep.app

    Weekly Downloads

    2

    Version

    2.0.7

    License

    MIT

    Unpacked Size

    4.27 kB

    Total Files

    7

    Last publish

    Collaborators

    • cdepage