Initial commit
This commit is contained in:
14
node_modules/get-symbol-description/.eslintrc
generated
vendored
Normal file
14
node_modules/get-symbol-description/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"id-length": 0,
|
||||
"new-cap": [2, {
|
||||
"capIsNewExceptions": [
|
||||
"GetIntrinsic",
|
||||
],
|
||||
}],
|
||||
},
|
||||
}
|
12
node_modules/get-symbol-description/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/get-symbol-description/.github/FUNDING.yml
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/get-symbol-description
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
9
node_modules/get-symbol-description/.nycrc
generated
vendored
Normal file
9
node_modules/get-symbol-description/.nycrc
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
47
node_modules/get-symbol-description/CHANGELOG.md
generated
vendored
Normal file
47
node_modules/get-symbol-description/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v1.0.2](https://github.com/inspect-js/get-symbol-description/compare/v1.0.1...v1.0.2) - 2024-02-07
|
||||
|
||||
### Fixed
|
||||
|
||||
- [Deps] add missing `get-intrinsic` [`#3`](https://github.com/inspect-js/get-symbol-description/issues/3)
|
||||
|
||||
## [v1.0.1](https://github.com/inspect-js/get-symbol-description/compare/v1.0.0...v1.0.1) - 2024-02-05
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] reuse common workflows [`168adf2`](https://github.com/inspect-js/get-symbol-description/commit/168adf213f86e5c69a93b4768a20ad543a70b231)
|
||||
- [meta] use `npmignore` to autogenerate an npmignore file [`fa3b323`](https://github.com/inspect-js/get-symbol-description/commit/fa3b323f0605cf966a5cef1a103ada46d63e466b)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `es-value-fixtures`, `foreach`, `object-inspect`, `tape` [`9301b9e`](https://github.com/inspect-js/get-symbol-description/commit/9301b9e274fd9b7544af3d7d437dd254e83095e0)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`a92a011`](https://github.com/inspect-js/get-symbol-description/commit/a92a0119f373fb61c58e3eb1d5fb6b3a3f66f157)
|
||||
- [actions] update rebase action to use reusable workflow [`66cea29`](https://github.com/inspect-js/get-symbol-description/commit/66cea29835bc88ab5e937ccf996ea96409475a0e)
|
||||
- [actions] update codecov uploader [`84079e1`](https://github.com/inspect-js/get-symbol-description/commit/84079e12e1421a79b63757cc3ab9c599e8eecc75)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `safe-publish-latest`, `tape` [`9f298a5`](https://github.com/inspect-js/get-symbol-description/commit/9f298a521e6f8a9b974b6b95e0b3de8aeaf74d9c)
|
||||
- [Dev Deps] use `hasown` instead of `has` [`e993bd6`](https://github.com/inspect-js/get-symbol-description/commit/e993bd62a08a1adc2f75664be99a36e031ecf604)
|
||||
- [Dev Deps] update `aud`, `npmignore`, `tape` [`5044bed`](https://github.com/inspect-js/get-symbol-description/commit/5044bed49a1b2b529b0c92fee0504747fda78147)
|
||||
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`3923eab`](https://github.com/inspect-js/get-symbol-description/commit/3923eabcf3eb2ddad7dbfd542102c29646dac242)
|
||||
- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`a24f5c5`](https://github.com/inspect-js/get-symbol-description/commit/a24f5c5f6ddd1f24b22ecdc2546eb9b06924f62a)
|
||||
- [Deps] update `call-bind`, `get-intrinsic` [`accd484`](https://github.com/inspect-js/get-symbol-description/commit/accd484cb970c11fb39eb5ec4301572fa4043e37)
|
||||
- [Dev Deps] update `object-inspect`, `tape` [`6c66623`](https://github.com/inspect-js/get-symbol-description/commit/6c666237114333bcb548e2c9ba6eb4924cb154ad)
|
||||
- [Dev Deps] update `object-inspect`, `tape` [`586dfe3`](https://github.com/inspect-js/get-symbol-description/commit/586dfe35b9b6e7dba3fb7577c5973b7466d101a3)
|
||||
- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`bc8c7e0`](https://github.com/inspect-js/get-symbol-description/commit/bc8c7e0382682164f78b87f41764a0a2e389c435)
|
||||
- [Tests] use `for-each` instead of `foreach` [`ca97918`](https://github.com/inspect-js/get-symbol-description/commit/ca97918eaad4ff1df11fd6f187da60227722dfcd)
|
||||
- [Robustness] cache String slice [`5ce0c56`](https://github.com/inspect-js/get-symbol-description/commit/5ce0c5658224ed5cf5c6775a18ee2ad60c5b7ba8)
|
||||
- [Deps] update `get-intrinsic` [`b656c5c`](https://github.com/inspect-js/get-symbol-description/commit/b656c5c68fbeec35d75a635ca991b61ed004bf54)
|
||||
- [Deps] update `get-intrinsic` [`74cf3b6`](https://github.com/inspect-js/get-symbol-description/commit/74cf3b6525c49998f2c984d350e4d59d7f70794c)
|
||||
- [meta] fix FUNDING.yml [`6cf76c8`](https://github.com/inspect-js/get-symbol-description/commit/6cf76c8c56bf366f767a84e82038db54b508641a)
|
||||
|
||||
## v1.0.0 - 2021-08-17
|
||||
|
||||
### Commits
|
||||
|
||||
- Initial commit: pulled from es-abstract [`6e34a05`](https://github.com/inspect-js/get-symbol-description/commit/6e34a05ef10ce8620078cf4cecbe276c1fc1ae77)
|
||||
- Initial commit [`3862092`](https://github.com/inspect-js/get-symbol-description/commit/3862092248d8ffa071ec90ec39d73e8be14ba6f1)
|
||||
- [meta] do not publish github action workflow files [`9d1e2b9`](https://github.com/inspect-js/get-symbol-description/commit/9d1e2b94dd97664da5d0666985a3695c23f45865)
|
||||
- npm init [`5051b32`](https://github.com/inspect-js/get-symbol-description/commit/5051b3221829f364c44b4d5e9a0c35aab3247f6a)
|
||||
- Only apps should have lockfiles [`b866d1c`](https://github.com/inspect-js/get-symbol-description/commit/b866d1c4b4029277618d968cfb3cbe00f012d1a7)
|
21
node_modules/get-symbol-description/LICENSE
generated
vendored
Normal file
21
node_modules/get-symbol-description/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Inspect JS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
43
node_modules/get-symbol-description/README.md
generated
vendored
Normal file
43
node_modules/get-symbol-description/README.md
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# get-symbol-description <sup>[![Version Badge][2]][1]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![dependency status][5]][6]
|
||||
[![dev dependency status][7]][8]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][11]][1]
|
||||
|
||||
Gets the description of a Symbol. Handles `Symbol()` vs `Symbol('')` properly when possible.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var getSymbolDescription = require('get-symbol-description');
|
||||
var assert = require('assert');
|
||||
|
||||
assert(getSymbolDescription(Symbol()) === undefined);
|
||||
assert(getSymbolDescription(Symbol('')) === ''); // or `undefined`, if in an engine that lacks name inference from concise method
|
||||
assert(getSymbolDescription(Symbol('foo')) === 'foo');
|
||||
assert(getSymbolDescription(Symbol.iterator) === 'Symbol.iterator');
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[1]: https://npmjs.org/package/get-symbol-description
|
||||
[2]: https://versionbadg.es/inspect-js/get-symbol-description.svg
|
||||
[5]: https://david-dm.org/inspect-js/get-symbol-description.svg
|
||||
[6]: https://david-dm.org/inspect-js/get-symbol-description
|
||||
[7]: https://david-dm.org/inspect-js/get-symbol-description/dev-status.svg
|
||||
[8]: https://david-dm.org/inspect-js/get-symbol-description#info=devDependencies
|
||||
[11]: https://nodei.co/npm/get-symbol-description.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/get-symbol-description.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/get-symbol-description.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=get-symbol-description
|
||||
[codecov-image]: https://codecov.io/gh/inspect-js/get-symbol-description/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/inspect-js/get-symbol-description/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/get-symbol-description
|
||||
[actions-url]: https://github.com/inspect-js/get-symbol-description/actions
|
10
node_modules/get-symbol-description/getInferredName.js
generated
vendored
Normal file
10
node_modules/get-symbol-description/getInferredName.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'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;
|
44
node_modules/get-symbol-description/index.js
generated
vendored
Normal file
44
node_modules/get-symbol-description/index.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $SyntaxError = require('es-errors/syntax');
|
||||
var getGlobalSymbolDescription = GetIntrinsic('%Symbol.keyFor%', true);
|
||||
var thisSymbolValue = callBound('%Symbol.prototype.valueOf%', true);
|
||||
var symToStr = callBound('Symbol.prototype.toString', true);
|
||||
var $strSlice = callBound('String.prototype.slice');
|
||||
|
||||
var getInferredName = require('./getInferredName');
|
||||
|
||||
/* eslint-disable consistent-return */
|
||||
module.exports = callBound('%Symbol.prototype.description%', true) || function getSymbolDescription(symbol) {
|
||||
if (!thisSymbolValue) {
|
||||
throw new $SyntaxError('Symbols are not supported in this environment');
|
||||
}
|
||||
|
||||
// will throw if not a symbol primitive or wrapper object
|
||||
var sym = thisSymbolValue(symbol);
|
||||
|
||||
if (getInferredName) {
|
||||
var name = getInferredName(sym);
|
||||
if (name === '') {
|
||||
return;
|
||||
}
|
||||
return name.slice(1, -1); // name.slice('['.length, -']'.length);
|
||||
}
|
||||
|
||||
var desc;
|
||||
if (getGlobalSymbolDescription) {
|
||||
desc = getGlobalSymbolDescription(sym);
|
||||
if (typeof desc === 'string') {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
desc = $strSlice(symToStr(sym), 7, -1); // str.slice('Symbol('.length, -')'.length);
|
||||
if (desc) {
|
||||
return desc;
|
||||
}
|
||||
};
|
80
node_modules/get-symbol-description/package.json
generated
vendored
Normal file
80
node_modules/get-symbol-description/package.json
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"name": "get-symbol-description",
|
||||
"version": "1.0.2",
|
||||
"description": "Gets the description of a Symbol. Handles `Symbol()` vs `Symbol('')` properly when possible.",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./getInferredName": "./getInferredName.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"lint": "eslint --ext=.js,.mjs .",
|
||||
"postlint": "evalmd README.md",
|
||||
"pretest": "npm run lint",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "aud --production",
|
||||
"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)\")\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/inspect-js/get-symbol-description.git"
|
||||
},
|
||||
"keywords": [
|
||||
"symbol",
|
||||
"ecmascript",
|
||||
"javascript",
|
||||
"description"
|
||||
],
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/inspect-js/get-symbol-description/issues"
|
||||
},
|
||||
"homepage": "https://github.com/inspect-js/get-symbol-description#readme",
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.5",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^21.1.0",
|
||||
"aud": "^2.0.4",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"es-value-fixtures": "^1.4.2",
|
||||
"eslint": "=8.8.0",
|
||||
"evalmd": "^0.0.19",
|
||||
"for-each": "^0.3.3",
|
||||
"hasown": "^2.0.0",
|
||||
"in-publish": "^2.0.1",
|
||||
"npmignore": "^0.3.1",
|
||||
"nyc": "^10.3.2",
|
||||
"object-inspect": "^1.13.1",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.7.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows"
|
||||
]
|
||||
}
|
||||
}
|
67
node_modules/get-symbol-description/test/index.js
generated
vendored
Normal file
67
node_modules/get-symbol-description/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var debug = require('object-inspect');
|
||||
var forEach = require('for-each');
|
||||
var hasOwn = require('hasown');
|
||||
var v = require('es-value-fixtures');
|
||||
|
||||
var getSymbolDescription = require('../');
|
||||
var getInferredName = require('../getInferredName');
|
||||
|
||||
test('getSymbolDescription', function (t) {
|
||||
t.test('no symbols', { skip: v.hasSymbols }, function (st) {
|
||||
st['throws'](
|
||||
getSymbolDescription,
|
||||
SyntaxError,
|
||||
'requires Symbol support'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
forEach(v.nonSymbolPrimitives.concat(v.objects), function (nonSymbol) {
|
||||
t['throws'](
|
||||
function () { getSymbolDescription(nonSymbol); },
|
||||
v.hasSymbols ? TypeError : SyntaxError,
|
||||
debug(nonSymbol) + ' is not a Symbol'
|
||||
);
|
||||
});
|
||||
|
||||
t.test('with symbols', { skip: !v.hasSymbols }, function (st) {
|
||||
forEach(
|
||||
[
|
||||
[Symbol(), undefined],
|
||||
[Symbol(undefined), undefined],
|
||||
[Symbol(null), 'null'],
|
||||
[Symbol.iterator, 'Symbol.iterator'],
|
||||
[Symbol('foo'), 'foo']
|
||||
],
|
||||
function (pair) {
|
||||
var sym = pair[0];
|
||||
var desc = pair[1];
|
||||
st.equal(getSymbolDescription(sym), desc, debug(sym) + ' description is ' + debug(desc));
|
||||
}
|
||||
);
|
||||
|
||||
st.test('only possible when inference or native `Symbol.prototype.description` is supported', {
|
||||
skip: !getInferredName && !hasOwn(Symbol.prototype, 'description')
|
||||
}, function (s2t) {
|
||||
s2t.equal(getSymbolDescription(Symbol('')), '', 'Symbol("") description is ""');
|
||||
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
st.test('only possible when global symbols are supported', {
|
||||
skip: !hasOwn(Symbol, 'for') || !hasOwn(Symbol, 'keyFor')
|
||||
}, function (s2t) {
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
s2t.equal(getSymbolDescription(Symbol['for']('')), '', 'Symbol.for("") description is ""');
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
Reference in New Issue
Block a user