well-known-symbols
v4.0.0
Published
An ESnext spec-compliant shim/polyfill/replacement for all Well-Known Symbols that works in any environment with Symbols.
Downloads
2,241,831
Keywords
Readme
well-known-symbols
An ESnext spec-compliant shim/polyfill/replacement for all Well-Known Symbols that works in any environment with Symbols.
New Well-Known Symbols will be added after they reach stage 3.
This package implements the es-shim API “multi” interface. It works in an ES3-supported environment and complies with the spec.
Note: functionality provided by this package prior to v4 can be found in:
- https://www.npmjs.com/package/is-registered-symbol
- https://www.npmjs.com/package/is-well-known-symbol
Getting started
npm install --save well-known-symbols
Usage/Examples
const assert = require('assert');
require('well-known-symbols/auto');
assert.equal(typeof Symbol.asyncIterator, 'symbol');
assert.equal(typeof Symbol.hasInstance, 'symbol');
assert.equal(typeof Symbol.isConcatSpreadable, 'symbol');
assert.equal(typeof Symbol.iterator, 'symbol');
assert.equal(typeof Symbol.match, 'symbol');
assert.equal(typeof Symbol.matchAll, 'symbol');
assert.equal(typeof Symbol.replace, 'symbol');
assert.equal(typeof Symbol.search, 'symbol');
assert.equal(typeof Symbol.species, 'symbol');
assert.equal(typeof Symbol.split, 'symbol');
assert.equal(typeof Symbol.toPrimitive, 'symbol');
assert.equal(typeof Symbol.toStringTag, 'symbol');
assert.equal(typeof Symbol.unscopables, 'symbol');
Tests
Clone the repo, npm install
, and run npm test