包详细信息

well-known-symbols

es-shims2.3mMIT4.1.0

An ESnext spec-compliant shim/polyfill/replacement for all Well-Known Symbols that works in any environment with Symbols.

javascript, ecmascript, polyfill, shim

自述文件

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

更新日志

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v4.1.0 - 2025-01-06

Commits

  • [New] add Symbol.dispose, Symbol.asyncDispose 303b0a6
  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, auto-changelog, is-registered-symbol, is-symbol, is-well-known-symbol, npmignore, tape 7316942
  • [Deps] update get-intrinsic, has-symbols 7f58dbd
  • [Dev Deps] update @es-shims/api 2e14122
  • [meta] add missing engines.node c14741e
  • [Tests] replace aud with npm audit 828e18f
  • [meta] add prepublishOnly script cbd7521
  • [Dev Deps] add missing peer dep f178b97

v4.0.0 - 2023-03-07

Commits

  • [Breaking] reimplementation as a "multi" es-shim 49d95db

v3.0.0 - 2020-02-01

Commits

v2.0.0 - 2018-09-16

Commits

v1.0.0 - 2017-02-27

Commits