1 | # is-set <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 |
|
---|
10 | Is this value a JS Set? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
|
---|
11 |
|
---|
12 | ## Example
|
---|
13 |
|
---|
14 | ```js
|
---|
15 | var isSet = require('is-set');
|
---|
16 | assert(!isSet(function () {}));
|
---|
17 | assert(!isSet(null));
|
---|
18 | assert(!isSet(function* () { yield 42; return Infinity; });
|
---|
19 | assert(!isSet(Symbol('foo')));
|
---|
20 | assert(!isSet(1n));
|
---|
21 | assert(!isSet(Object(1n)));
|
---|
22 |
|
---|
23 | assert(!isSet(new Map()));
|
---|
24 | assert(!isSet(new WeakSet()));
|
---|
25 | assert(!isSet(new WeakMap()));
|
---|
26 |
|
---|
27 | assert(isSet(new Set()));
|
---|
28 |
|
---|
29 | class MySet extends Set {}
|
---|
30 | assert(isSet(new MySet()));
|
---|
31 | ```
|
---|
32 |
|
---|
33 | ## Tests
|
---|
34 | Simply clone the repo, `npm install`, and run `npm test`
|
---|
35 |
|
---|
36 | [package-url]: https://npmjs.org/package/is-set
|
---|
37 | [npm-version-svg]: https://versionbadg.es/inspect-js/is-set.svg
|
---|
38 | [deps-svg]: https://david-dm.org/inspect-js/is-set.svg
|
---|
39 | [deps-url]: https://david-dm.org/inspect-js/is-set
|
---|
40 | [dev-deps-svg]: https://david-dm.org/inspect-js/is-set/dev-status.svg
|
---|
41 | [dev-deps-url]: https://david-dm.org/inspect-js/is-set#info=devDependencies
|
---|
42 | [npm-badge-png]: https://nodei.co/npm/is-set.png?downloads=true&stars=true
|
---|
43 | [license-image]: https://img.shields.io/npm/l/is-set.svg
|
---|
44 | [license-url]: LICENSE
|
---|
45 | [downloads-image]: https://img.shields.io/npm/dm/is-set.svg
|
---|
46 | [downloads-url]: https://npm-stat.com/charts.html?package=is-set
|
---|
47 | [codecov-image]: https://codecov.io/gh/inspect-js/is-set/branch/main/graphs/badge.svg
|
---|
48 | [codecov-url]: https://app.codecov.io/gh/inspect-js/is-set/
|
---|
49 | [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-set
|
---|
50 | [actions-url]: https://github.com/inspect-js/is-set/actions
|
---|