Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inspect-js/is-map
Is this value a JS Map? This module works cross-realm/iframe, and despite %Symbol.toStringTag%.
https://github.com/inspect-js/is-map
collection ecmascript is javascript map set
Last synced: 8 days ago
JSON representation
Is this value a JS Map? This module works cross-realm/iframe, and despite %Symbol.toStringTag%.
- Host: GitHub
- URL: https://github.com/inspect-js/is-map
- Owner: inspect-js
- License: mit
- Created: 2019-11-09T23:15:38.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-03-11T05:03:43.000Z (8 months ago)
- Last Synced: 2024-10-18T16:17:51.660Z (26 days ago)
- Topics: collection, ecmascript, is, javascript, map, set
- Language: JavaScript
- Homepage:
- Size: 85 KB
- Stars: 8
- Watchers: 4
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# is-map [![Version Badge][npm-version-svg]][package-url]
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url][![npm badge][npm-badge-png]][package-url]
Is this value a JS Map? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
## Example
```js
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`[package-url]: https://npmjs.org/package/is-map
[npm-version-svg]: https://versionbadg.es/inspect-js/is-map.svg
[deps-svg]: https://david-dm.org/inspect-js/is-map.svg
[deps-url]: https://david-dm.org/inspect-js/is-map
[dev-deps-svg]: https://david-dm.org/inspect-js/is-map/dev-status.svg
[dev-deps-url]: https://david-dm.org/inspect-js/is-map#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/is-map.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/is-map.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/is-map.svg
[downloads-url]: https://npm-stat.com/charts.html?package=is-map
[codecov-image]: https://codecov.io/gh/inspect-js/is-map/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/inspect-js/is-map/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-map
[actions-url]: https://github.com/inspect-js/is-map/actions