has-symbols
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -8,2 +8,18 @@ # Changelog | ||
## [v1.1.0](https://github.com/inspect-js/has-symbols/compare/v1.0.3...v1.1.0) - 2024-12-02 | ||
### Commits | ||
- [actions] update workflows [`548c0bf`](https://github.com/inspect-js/has-symbols/commit/548c0bf8c9b1235458df7a1c0490b0064647a282) | ||
- [actions] further shard; update action deps [`bec56bb`](https://github.com/inspect-js/has-symbols/commit/bec56bb0fb44b43a786686b944875a3175cf3ff3) | ||
- [meta] use `npmignore` to autogenerate an npmignore file [`ac81032`](https://github.com/inspect-js/has-symbols/commit/ac81032809157e0a079e5264e9ce9b6f1275777e) | ||
- [New] add types [`6469cbf`](https://github.com/inspect-js/has-symbols/commit/6469cbff1866cfe367b2b3d181d9296ec14b2a3d) | ||
- [actions] update rebase action to use reusable workflow [`9c9d4d0`](https://github.com/inspect-js/has-symbols/commit/9c9d4d0d8938e4b267acdf8e421f4e92d1716d72) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`adb5887`](https://github.com/inspect-js/has-symbols/commit/adb5887ca9444849b08beb5caaa9e1d42320cdfb) | ||
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`13ec198`](https://github.com/inspect-js/has-symbols/commit/13ec198ec80f1993a87710af1606a1970b22c7cb) | ||
- [Dev Deps] update `auto-changelog`, `core-js`, `tape` [`941be52`](https://github.com/inspect-js/has-symbols/commit/941be5248387cab1da72509b22acf3fdb223f057) | ||
- [Tests] replace `aud` with `npm audit` [`74f49e9`](https://github.com/inspect-js/has-symbols/commit/74f49e9a9d17a443020784234a1c53ce765b3559) | ||
- [Dev Deps] update `npmignore` [`9c0ac04`](https://github.com/inspect-js/has-symbols/commit/9c0ac0452a834f4c2a4b54044f2d6a89f17e9a70) | ||
- [Dev Deps] add missing peer dep [`52337a5`](https://github.com/inspect-js/has-symbols/commit/52337a5621cced61f846f2afdab7707a8132cc12) | ||
## [v1.0.3](https://github.com/inspect-js/has-symbols/compare/v1.0.2...v1.0.3) - 2022-03-01 | ||
@@ -10,0 +26,0 @@ |
@@ -6,2 +6,3 @@ 'use strict'; | ||
/** @type {import('.')} */ | ||
module.exports = function hasNativeSymbols() { | ||
@@ -8,0 +9,0 @@ if (typeof origSymbol !== 'function') { return false; } |
{ | ||
"name": "has-symbols", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Determine if the JS environment has Symbol support. Supports spec, or shams.", | ||
"main": "index.js", | ||
"scripts": { | ||
"prepack": "npmignore --auto --commentLines=autogenerated", | ||
"prepublishOnly": "safe-publish-latest", | ||
@@ -11,4 +12,4 @@ "prepublish": "not-in-publish || npm run prepublishOnly", | ||
"test": "npm run tests-only", | ||
"posttest": "aud --production", | ||
"tests-only": "npm run test:stock && npm run test:staging && npm run test:shams", | ||
"posttest": "npx npm@'>=10.2' audit --production", | ||
"tests-only": "npm run test:stock && npm run test:shams", | ||
"test:stock": "nyc node test", | ||
@@ -20,2 +21,3 @@ "test:staging": "nyc node --harmony --es-staging test", | ||
"lint": "eslint --ext=js,mjs .", | ||
"postlint": "tsc -p . && attw -P", | ||
"version": "auto-changelog && git add CHANGELOG.md", | ||
@@ -59,11 +61,18 @@ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" | ||
"devDependencies": { | ||
"@ljharb/eslint-config": "^20.2.3", | ||
"aud": "^2.0.0", | ||
"auto-changelog": "^2.4.0", | ||
"@arethetypeswrong/cli": "^0.17.0", | ||
"@ljharb/eslint-config": "^21.1.1", | ||
"@ljharb/tsconfig": "^0.2.0", | ||
"@types/core-js": "^2.5.8", | ||
"@types/tape": "^5.6.5", | ||
"auto-changelog": "^2.5.0", | ||
"core-js": "^2.6.12", | ||
"encoding": "^0.1.13", | ||
"eslint": "=8.8.0", | ||
"get-own-property-symbols": "^0.9.5", | ||
"in-publish": "^2.0.1", | ||
"npmignore": "^0.3.1", | ||
"nyc": "^10.3.2", | ||
"safe-publish-latest": "^2.0.0", | ||
"tape": "^5.5.2" | ||
"tape": "^5.9.0", | ||
"typescript": "next" | ||
}, | ||
@@ -99,7 +108,8 @@ "testling": { | ||
}, | ||
"greenkeeper": { | ||
"publishConfig": { | ||
"ignore": [ | ||
"core-js" | ||
".github/workflows", | ||
"types" | ||
] | ||
} | ||
} |
'use strict'; | ||
/** @type {import('./shams')} */ | ||
/* eslint complexity: [2, 18], max-statements: [2, 33] */ | ||
@@ -8,2 +9,3 @@ module.exports = function hasSymbols() { | ||
/** @type {{ [k in symbol]?: unknown }} */ | ||
var obj = {}; | ||
@@ -27,3 +29,3 @@ var sym = Symbol('test'); | ||
obj[sym] = symVal; | ||
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop | ||
for (var _ in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop | ||
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } | ||
@@ -39,3 +41,4 @@ | ||
if (typeof Object.getOwnPropertyDescriptor === 'function') { | ||
var descriptor = Object.getOwnPropertyDescriptor(obj, sym); | ||
// eslint-disable-next-line no-extra-parens | ||
var descriptor = /** @type {PropertyDescriptor} */ (Object.getOwnPropertyDescriptor(obj, sym)); | ||
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } | ||
@@ -42,0 +45,0 @@ } |
@@ -11,2 +11,3 @@ 'use strict'; | ||
}); | ||
// @ts-expect-error TS is stupid and doesn't know about top level return | ||
return; | ||
@@ -13,0 +14,0 @@ } |
@@ -11,2 +11,3 @@ 'use strict'; | ||
}); | ||
// @ts-expect-error TS is stupid and doesn't know about top level return | ||
return; | ||
@@ -13,0 +14,0 @@ } |
'use strict'; | ||
/** @type {(t: import('tape').Test) => false | void} */ | ||
// eslint-disable-next-line consistent-return | ||
@@ -34,2 +35,3 @@ module.exports = function runSymbolTests(t) { | ||
/** @type {{ [k in symbol]?: unknown }} */ | ||
var obj = {}; | ||
@@ -44,4 +46,4 @@ var sym = Symbol('test'); | ||
obj[sym] = symVal; | ||
// eslint-disable-next-line no-restricted-syntax | ||
for (sym in obj) { t.fail('symbol property key was found in for..in of object'); } | ||
// eslint-disable-next-line no-restricted-syntax, no-unused-vars | ||
for (var _ in obj) { t.fail('symbol property key was found in for..in of object'); } | ||
@@ -48,0 +50,0 @@ t.deepEqual(Object.keys(obj), [], 'no enumerable own keys on symbol-valued object'); |
23409
16
167
16