is-map
Is this value a JS Map? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
Last updated 9 months ago by ljharb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install is-map 
SYNC missed versions from official npm registry.

is-map Version Badge

Build Status dependency status dev dependency status License Downloads

npm badge

Is this value a JS Map? This module works cross-realm/iframe, and despite ES6 @@toStringTag.

Example

var isMap = require('is-map');
assert(!isMap(function () {}));
assert(!isMap(null));
assert(!isMap(function* () { yield 42; return Infinity; });
assert(!isMap(Symbol('foo')));
assert(!isMap(1n));
assert(!isMap(Object(1n)));

assert(!isMap(new Set()));
assert(!isMap(new WeakSet()));
assert(!isMap(new WeakMap()));

assert(isMap(new Map()));

class MyMap extends Map {}
assert(isMap(new MyMap()));

Tests

Simply clone the repo, npm install, and run npm test

Current Tags

  • 2.0.1                                ...           latest (9 months ago)

4 Versions

  • 2.0.1                                ...           9 months ago
  • 2.0.0                                ...           10 months ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 892
This Week 3,665
This Month 26,580
Last Day 1,416
Last Week 8,503
Last Month 42,810
Dependencies (0)
None
Dev Dependencies (9)

Copyright 2014 - 2016 © taobao.org |