4.0.0 • Published 1 year ago

well-known-symbols v4.0.0

Weekly downloads
286,272
License
MIT
Repository
github
Last release
1 year ago

well-known-symbols Version Badge

github actions coverage License Downloads

npm badge

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:

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