symbol.prototype.description
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,3 +0,39 @@ | ||
1.0.0 / 2018-01-23 | ||
================== | ||
* Initial relase | ||
### Changelog | ||
All notable changes to this project will be documented in this file. Dates are displayed in UTC. | ||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). | ||
#### [v1.0.1](https://github.com/es-shims/Symbol.prototype.description/compare/v1.0.0...v1.0.1) | ||
> 19 October 2019 | ||
- [Fix] `polyfill`: fix always-true logic [`#3`](https://github.com/es-shims/Symbol.prototype.description/issues/3) | ||
- [Tests] up to `node` `v12.12`, `v11.15`, `v10.16`, `v8.16`, `v6.17` [`66278dd`](https://github.com/es-shims/Symbol.prototype.description/commit/66278dd1d06771eb13a9b02903740bb751e0f39d) | ||
- [Tests] up to `node` `v10.4`, `v9.11`, `v8.11`, `v6.14`, `v4.9` [`8bdca03`](https://github.com/es-shims/Symbol.prototype.description/commit/8bdca03cb3296b0f2a73815255dd1d2cde7114cd) | ||
- [Refactor] use `getSymbolDescription` and `getInferredName` helpers from `es-abstract` [`d6b2c51`](https://github.com/es-shims/Symbol.prototype.description/commit/d6b2c51d2f7d1489cef94705be0c9ced8becd779) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`; add `safe-publish-latest` [`ea4841b`](https://github.com/es-shims/Symbol.prototype.description/commit/ea4841b269810db4d788ff1913c47494a3bab6de) | ||
- [meta] add `auto-changelog` [`415dcaf`](https://github.com/es-shims/Symbol.prototype.description/commit/415dcafd2f95836497fdf2e4336ebd2d5319434c) | ||
- [Dev Deps] update `eslint`, `nsp`, `tape` [`25d2c71`](https://github.com/es-shims/Symbol.prototype.description/commit/25d2c71074f7f8e7844196c00df908528a6dc3e9) | ||
- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`32f79e9`](https://github.com/es-shims/Symbol.prototype.description/commit/32f79e9e1eeacb14cb968113c16becdf73477ba3) | ||
#### v1.0.0 | ||
> 23 January 2018 | ||
- [Fix] use function name inference and computed properties to distinguish `Symbol()` from `Symbol(‘’)`, when available [`#2`](https://github.com/es-shims/Symbol.prototype.description/pull/2) | ||
- [Fix] use function name inference and computed properties to distinguish `Symbol()` from `Symbol(‘’)`, when available. [`#1`](https://github.com/es-shims/Symbol.prototype.description/issues/1) | ||
- [Tests] add travis-ci and `npm run security` [`b889123`](https://github.com/es-shims/Symbol.prototype.description/commit/b8891233987b6d3b3805d25071f7353d30275f41) | ||
- Implementation. [`5bafd04`](https://github.com/es-shims/Symbol.prototype.description/commit/5bafd04c3efdb20feb62a9512cc74572ce44fe72) | ||
- Tests [`96aee94`](https://github.com/es-shims/Symbol.prototype.description/commit/96aee940ec05d288462e109f0e531b128963d262) | ||
- Initial commit [`fff1a67`](https://github.com/es-shims/Symbol.prototype.description/commit/fff1a671c95a111fe782014f2be56c3ee9567fa8) | ||
- Read me [`3d21280`](https://github.com/es-shims/Symbol.prototype.description/commit/3d21280e12c8c24c2ba059b9bd3224bce5ee3439) | ||
- [Tests] up to `node` `v9.2`, `v8.9`, `v6.12`; use `nvm install-latest-npm`; pin included builds to LTSr [`c6d1807`](https://github.com/es-shims/Symbol.prototype.description/commit/c6d18077067a5fc2835a0d38bbc90b28fb98e8e4) | ||
- [Tests] add `npm run lint` [`1e4562c`](https://github.com/es-shims/Symbol.prototype.description/commit/1e4562c1f13aa0d9a7fc08f1801d47f13ba2d644) | ||
- package.json [`6d53036`](https://github.com/es-shims/Symbol.prototype.description/commit/6d530361a2c930490d0e6799992c0639b01b95c8) | ||
- [Fix] only shim global Symbol when needed [`10f4fa2`](https://github.com/es-shims/Symbol.prototype.description/commit/10f4fa2f8d6102ef8f5a07b23438d6a793c65c6b) | ||
- Flesh out es-shim-api requirements. [`6bf128a`](https://github.com/es-shims/Symbol.prototype.description/commit/6bf128a0e383d6dc1acbc33e394644dca7e3e4dc) | ||
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `eslint`, `nsp`, `tape` [`9651fb6`](https://github.com/es-shims/Symbol.prototype.description/commit/9651fb616ca37ae24f85ebc9c4bd57bf6f722f24) | ||
- Rename and move the repo. [`e136d90`](https://github.com/es-shims/Symbol.prototype.description/commit/e136d90b2213102cb4b60c00039b394d0ebba33d) | ||
- Only apps should have lockfiles. [`74239df`](https://github.com/es-shims/Symbol.prototype.description/commit/74239df051bb8bf488aa08b16be04a7e672f4d74) | ||
- [Dev Deps] update `@es-shims/api`, `eslint` [`e3c8d64`](https://github.com/es-shims/Symbol.prototype.description/commit/e3c8d64ea4016682298c8ac97a2726e9b61f77b0) |
'use strict'; | ||
var getInferredName; | ||
try { | ||
// eslint-disable-next-line no-new-func | ||
getInferredName = Function('s', 'return { [s]() {} }[s].name;'); | ||
} catch (e) {} | ||
var inferred = function () {}; | ||
module.exports = getInferredName && inferred.name === 'inferred' ? getInferredName : null; | ||
module.exports = require('es-abstract/helpers/getInferredName'); |
'use strict'; | ||
var hasSymbols = require('has-symbols')(); | ||
var symToStr = hasSymbols ? Function.call.bind(Symbol.prototype.toString) : null; | ||
var getInferredName = require('./helpers/getInferredName'); | ||
var getSymbolDescription = require('es-abstract/helpers/getSymbolDescription'); | ||
module.exports = function description() { | ||
var str = symToStr(this); // will throw if not a Symbol | ||
if (getInferredName) { | ||
var name = getInferredName(this); | ||
if (name === '') { return; } | ||
return name.slice(1, -1); // name.slice('['.length, -']'.length); | ||
} | ||
var desc = str.slice(7, -1); // str.slice('Symbol('.length, -')'.length); | ||
if (desc) { | ||
return desc; | ||
} | ||
return getSymbolDescription(this); | ||
}; |
{ | ||
"name": "symbol.prototype.description", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Spec-compliant shim for Symbol.prototype.description proposal.", | ||
"main": "index.js", | ||
"scripts": { | ||
"version": "auto-changelog && git add CHANGELOG.md", | ||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"", | ||
"prepublish": "safe-publish-latest", | ||
"lint": "eslint .", | ||
"postlint": "es-shim-api --bound --skip-shim-returns-polyfill", | ||
"security": "nsp check", | ||
"tests-only": "node test && node test/shimmed", | ||
"pretest": "npm run lint", | ||
"test": "npm run tests-only", | ||
"posttest": "npm run security" | ||
"posttest": "npx aud" | ||
}, | ||
@@ -35,2 +37,3 @@ "repository": { | ||
"dependencies": { | ||
"es-abstract": "^1.16.0", | ||
"has-symbols": "^1.0.0" | ||
@@ -40,10 +43,17 @@ }, | ||
"@es-shims/api": "^2.1.2", | ||
"@ljharb/eslint-config": "^12.2.1", | ||
"eslint": "^4.16.0", | ||
"nsp": "^3.1.0", | ||
"tape": "^4.8.0" | ||
"@ljharb/eslint-config": "^14.1.0", | ||
"auto-changelog": "^1.16.1", | ||
"eslint": "^6.5.1", | ||
"safe-publish-latest": "^1.1.3", | ||
"tape": "^4.11.0" | ||
}, | ||
"engines": { | ||
"node": ">= 0.12" | ||
}, | ||
"auto-changelog": { | ||
"output": "CHANGELOG.md", | ||
"unreleased": false, | ||
"commitLimit": false, | ||
"backfillLimit": false | ||
} | ||
} |
@@ -12,2 +12,3 @@ 'use strict'; | ||
} | ||
var desc = gOPD(Symbol.prototype, 'description'); | ||
@@ -17,3 +18,6 @@ if (!desc || typeof desc.get !== 'function') { | ||
} | ||
if (typeof desc.get.call(Symbol()) !== 'undefined' || desc.get.call(Symbol()) !== '' || desc.get.call(Symbol('a')) !== 'a') { | ||
var emptySymbolDesc = desc.get.call(Symbol()); | ||
var emptyDescValid = typeof emptySymbolDesc === 'undefined' || emptySymbolDesc === ''; | ||
if (!emptyDescValid || desc.get.call(Symbol('a')) !== 'a') { | ||
return implementation; | ||
@@ -20,0 +24,0 @@ } |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var polyfill = require('./polyfill'); | ||
var getInferredName = require('./helpers/getInferredName'); | ||
var getInferredName = require('es-abstract/helpers/getInferredName'); | ||
@@ -8,0 +8,0 @@ var gOPD = Object.getOwnPropertyDescriptor; |
@@ -12,3 +12,3 @@ 'use strict'; | ||
var runTests = require('./tests'); | ||
var getInferredName = require('../helpers/getInferredName'); | ||
var getInferredName = require('es-abstract/helpers/getInferredName'); | ||
@@ -15,0 +15,0 @@ test('shimmed', function (t) { |
'use strict'; | ||
var hasSymbols = require('has-symbols')(); | ||
var getInferredName = require('../helpers/getInferredName'); | ||
var getInferredName = require('es-abstract/helpers/getInferredName'); | ||
@@ -6,0 +6,0 @@ module.exports = function (description, t) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26458
2
6
16
170
+ Addedes-abstract@^1.16.0
+ Addedarray-buffer-byte-length@1.0.1(transitive)
+ Addedarraybuffer.prototype.slice@1.0.3(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.2(transitive)
+ Addeddata-view-buffer@1.0.1(transitive)
+ Addeddata-view-byte-length@1.0.1(transitive)
+ Addeddata-view-byte-offset@1.0.0(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddunder-proto@1.0.0(transitive)
+ Addedes-abstract@1.23.5(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedes-set-tostringtag@2.0.3(transitive)
+ Addedes-to-primitive@1.3.0(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunction.prototype.name@1.1.6(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedget-intrinsic@1.2.6(transitive)
+ Addedget-symbol-description@1.0.2(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-bigints@1.0.2(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.2.0(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinternal-slot@1.1.0(transitive)
+ Addedis-array-buffer@3.0.4(transitive)
+ Addedis-async-function@2.0.0(transitive)
+ Addedis-bigint@1.1.0(transitive)
+ Addedis-boolean-object@1.2.1(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-data-view@1.0.2(transitive)
+ Addedis-date-object@1.1.0(transitive)
+ Addedis-finalizationregistry@1.1.0(transitive)
+ Addedis-generator-function@1.0.10(transitive)
+ Addedis-map@2.0.3(transitive)
+ Addedis-negative-zero@2.0.3(transitive)
+ Addedis-number-object@1.1.0(transitive)
+ Addedis-regex@1.2.1(transitive)
+ Addedis-set@2.0.3(transitive)
+ Addedis-shared-array-buffer@1.0.3(transitive)
+ Addedis-string@1.1.0(transitive)
+ Addedis-symbol@1.1.1(transitive)
+ Addedis-typed-array@1.1.13(transitive)
+ Addedis-weakmap@2.0.2(transitive)
+ Addedis-weakref@1.1.0(transitive)
+ Addedis-weakset@2.0.3(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedmath-intrinsics@1.0.0(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.5(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedreflect.getprototypeof@1.0.8(transitive)
+ Addedregexp.prototype.flags@1.5.3(transitive)
+ Addedsafe-array-concat@1.1.3(transitive)
+ Addedsafe-regex-test@1.1.0(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedside-channel@1.1.0(transitive)
+ Addedside-channel-list@1.0.0(transitive)
+ Addedside-channel-map@1.0.1(transitive)
+ Addedside-channel-weakmap@1.0.2(transitive)
+ Addedstring.prototype.trim@1.2.10(transitive)
+ Addedstring.prototype.trimend@1.0.9(transitive)
+ Addedstring.prototype.trimstart@1.0.8(transitive)
+ Addedtyped-array-buffer@1.0.2(transitive)
+ Addedtyped-array-byte-length@1.0.1(transitive)
+ Addedtyped-array-byte-offset@1.0.3(transitive)
+ Addedtyped-array-length@1.0.7(transitive)
+ Addedunbox-primitive@1.0.2(transitive)
+ Addedwhich-boxed-primitive@1.1.0(transitive)
+ Addedwhich-builtin-type@1.2.1(transitive)
+ Addedwhich-collection@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.16(transitive)