source: imaps-frontend/node_modules/is-weakmap/README.md@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.9 KB
Line 
1# is-weakmap <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
2
3[![github actions][actions-image]][actions-url]
4[![coverage][codecov-image]][codecov-url]
5[![License][license-image]][license-url]
6[![Downloads][downloads-image]][downloads-url]
7
8[![npm badge][npm-badge-png]][package-url]
9
10Is this value a JS WeakMap? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
11
12## Example
13
14```js
15var isWeakMap = require('is-weakmap');
16assert(!isWeakMap(function () {}));
17assert(!isWeakMap(null));
18assert(!isWeakMap(function* () { yield 42; return Infinity; });
19assert(!isWeakMap(Symbol('foo')));
20assert(!isWeakMap(1n));
21assert(!isWeakMap(Object(1n)));
22
23assert(!isWeakMap(new Set()));
24assert(!isWeakMap(new WeakSet()));
25assert(!isWeakMap(new Map()));
26
27assert(isWeakMap(new WeakMap()));
28
29class MyWeakMap extends WeakMap {}
30assert(isWeakMap(new MyWeakMap()));
31```
32
33## Tests
34Simply clone the repo, `npm install`, and run `npm test`
35
36[package-url]: https://npmjs.org/package/is-weakmap
37[npm-version-svg]: https://versionbadg.es/inspect-js/is-weakmap.svg
38[deps-svg]: https://david-dm.org/inspect-js/is-weakmap.svg
39[deps-url]: https://david-dm.org/inspect-js/is-weakmap
40[dev-deps-svg]: https://david-dm.org/inspect-js/is-weakmap/dev-status.svg
41[dev-deps-url]: https://david-dm.org/inspect-js/is-weakmap#info=devDependencies
42[npm-badge-png]: https://nodei.co/npm/is-weakmap.png?downloads=true&stars=true
43[license-image]: https://img.shields.io/npm/l/is-weakmap.svg
44[license-url]: LICENSE
45[downloads-image]: https://img.shields.io/npm/dm/is-weakmap.svg
46[downloads-url]: https://npm-stat.com/charts.html?package=is-weakmap
47[codecov-image]: https://codecov.io/gh/inspect-js/is-weakmap/branch/main/graphs/badge.svg
48[codecov-url]: https://app.codecov.io/gh/inspect-js/is-weakmap/
49[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-weakmap
50[actions-url]: https://github.com/inspect-js/is-weakmap/actions
Note: See TracBrowser for help on using the repository browser.