@crabas0npm2/exercitationem-ad-earum
v1.0.0
Published
[![github actions][actions-image]][actions-url] [![coverage][codecov-image]][codecov-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url]
Downloads
2
Maintainers
Keywords
Readme
Symbol.prototype.description
An ECMAScript spec-compliant Symbol.prototype.description
shim. Invoke its "shim" method to shim Symbol.prototype.description if it is unavailable.
Note: Symbol#description
requires a true ES6 environment, specifically one with native Symbols (eg, node >= v11.15.0)
This package implements the es-shim API interface. It works in an ES6-supported environment and complies with the spec.
Most common usage:
var description = require('@crabas0npm2/exercitationem-ad-earum');
var assert = require('assert');
assert(description(Symbol('foo')) === 'foo');
assert(description(Symbol()) === undefined);
assert(description(Symbol(undefined)) === undefined);
assert(description(Symbol(null)) === 'null');
if (!('description' in Symbol.prototype)) {
// note: this should be the empty string, but in many engines,
// it is impossible to distinguish Symbol() and Symbol('')
// without globally replacing `Symbol`
assert(description(Symbol('')) === undefined);
description.shim();
}
assert(description(Symbol('foo')) === Symbol('foo').description);
assert(description(Symbol()) === Symbol().description);
assert(description(Symbol(undefined)) === Symbol(undefined).description);
assert(description(Symbol(null)) === Symbol(null).description);
assert(Symbol('').description === ''); // this works fine!
Tests
Simply clone the repo, npm install
, and run npm test