Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@silen/is-map

sileny9MIT1.0.3TypeScript support: included

Check if the parameter is map

type, typescript, isMap, is-map

readme

is-map

Determine if a value is Map

install

npm i @silen/is-map

api

  • declare function isMap(val: any): boolean;

usage

const { isMap } = require('@silen/is-map');
// or
import { isMap } from '@silen/is-map';

console.log(isMap(new Buffer(4)));
console.log(isMap(Buffer.alloc(4)));
console.log(isMap(undefined));
console.log(isMap(null));
console.log(isMap(''));
console.log(isMap(true));
console.log(isMap(0));
console.log(isMap(1));
console.log(isMap(1.0));
console.log(isMap('string'));
console.log(isMap({}));
console.log(isMap(function foo() {}));
console.log(isMap(Symbol()));
console.log(isMap(new Set));
console.log(isMap(new Map));
console.log(isMap(new WeakMap));
console.log(isMap(new WeakSet));

// or
console.log(window.Type.isMap(new WeakSet));

This is a demo for testing the usage of isMap from @silen/is-map module. You can try the others and do likewise.

others