first commit
This commit is contained in:
24
node_modules/function.prototype.name/.editorconfig
generated
vendored
Normal file
24
node_modules/function.prototype.name/.editorconfig
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = off
|
||||
|
||||
[CHANGELOG.md]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[README.md]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.json]
|
||||
max_line_length = off
|
||||
|
||||
[Makefile]
|
||||
max_line_length = off
|
||||
15
node_modules/function.prototype.name/.eslintrc
generated
vendored
Normal file
15
node_modules/function.prototype.name/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"max-lines-per-function": 0,
|
||||
"new-cap": [2, {
|
||||
"capIsNewExceptions": [
|
||||
"HasOwnProperty",
|
||||
"IsCallable",
|
||||
],
|
||||
}],
|
||||
},
|
||||
}
|
||||
12
node_modules/function.prototype.name/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/function.prototype.name/.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/function.prototype.name
|
||||
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/function.prototype.name/.nycrc
generated
vendored
Normal file
9
node_modules/function.prototype.name/.nycrc
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
||||
141
node_modules/function.prototype.name/CHANGELOG.md
generated
vendored
Normal file
141
node_modules/function.prototype.name/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
# 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.1.8](https://github.com/es-shims/Function.prototype.name/compare/v1.1.7...v1.1.8) - 2024-12-19
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] split out node 10-20, and 20+ [`b5ea555`](https://github.com/es-shims/Function.prototype.name/commit/b5ea555b2a4db8eb531bccb4d6b2c916de9b8089)
|
||||
- [Refactor] use `call-bound` directly [`f6a6c64`](https://github.com/es-shims/Function.prototype.name/commit/f6a6c640f7f209c3fc1ea65c0eb31e622e2c9399)
|
||||
|
||||
## [v1.1.7](https://github.com/es-shims/Function.prototype.name/compare/v1.1.6...v1.1.7) - 2024-12-15
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] split out node 10-20, and 20+ [`47155b0`](https://github.com/es-shims/Function.prototype.name/commit/47155b0bef19c37e5cf9dfff393bc14c6079959a)
|
||||
- [Refactor] use `hasown` and `is-callable` directly, instead of `es-abstract` [`d5118d6`](https://github.com/es-shims/Function.prototype.name/commit/d5118d65f89f8af4d1109943955ba65f88f4aa6b)
|
||||
- [Deps] update `call-bind`, `define-properties`, `es-abstract` [`cfa8b2e`](https://github.com/es-shims/Function.prototype.name/commit/cfa8b2e4fcfa437dde6436c2c34e3eb4bb646907)
|
||||
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `auto-changelog`, `npmignore`, `tape` [`2077d9a`](https://github.com/es-shims/Function.prototype.name/commit/2077d9a9039c7cbf78816188bf486560366437bc)
|
||||
- [Tests] replace `aud` with `npm audit` [`219e0a4`](https://github.com/es-shims/Function.prototype.name/commit/219e0a43a3de2d96e78ec61a43ccb61be40d8da8)
|
||||
- [Dev Deps] add missing peer dep [`0b16b2b`](https://github.com/es-shims/Function.prototype.name/commit/0b16b2b1013b3c92793bcf87c573eab356e00388)
|
||||
|
||||
## [v1.1.6](https://github.com/es-shims/Function.prototype.name/compare/v1.1.5...v1.1.6) - 2023-08-28
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] reuse common workflows [`5f6bfba`](https://github.com/es-shims/Function.prototype.name/commit/5f6bfba9d2c42fbac8f4812396bc71f79464846c)
|
||||
- [meta] use `npmignore` to autogenerate an npmignore file [`28ea2f9`](https://github.com/es-shims/Function.prototype.name/commit/28ea2f9a9dd48623cba04e94c491033f1c9d1e90)
|
||||
- [Fix] properly recognize `document.all` in IE 6-8 [`316d676`](https://github.com/es-shims/Function.prototype.name/commit/316d67641d54bf221ed5edfdb9e04af3b98caad8)
|
||||
- [Fix] only return an own `name` [`d647609`](https://github.com/es-shims/Function.prototype.name/commit/d6476090e110733b52a922f4d0dbfdbc9478c653)
|
||||
- [Tests] add browserstack browser tests [`67ae402`](https://github.com/es-shims/Function.prototype.name/commit/67ae402aabcad83df2f7d7e356d059a84fe71f44)
|
||||
- [meta] better `eccheck` command [`728df4c`](https://github.com/es-shims/Function.prototype.name/commit/728df4cc81a51a131a36c0768c4adb7668ad7569)
|
||||
- [meta] add `auto-changelog` [`dbb700b`](https://github.com/es-shims/Function.prototype.name/commit/dbb700b38ef4c18e0ce0670a2ffface9ffd251a0)
|
||||
- [readme] fix eclint [`c98fdf1`](https://github.com/es-shims/Function.prototype.name/commit/c98fdf1bc5451de667945c41187a67022f750001)
|
||||
- [readme] add tested browsers [`d41325c`](https://github.com/es-shims/Function.prototype.name/commit/d41325ceec61627f63281d0649e4e0004f3e0609)
|
||||
- [actions] update rebase action to use reusable workflow [`085f340`](https://github.com/es-shims/Function.prototype.name/commit/085f3400785cd4f3fb762b73b095f5dfb795a0b3)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `safe-publish-latest`, `tape` [`3f071ce`](https://github.com/es-shims/Function.prototype.name/commit/3f071cef2e1feebfd7d0daea7d6392c2feada091)
|
||||
- [actions] update codecov uploader [`a187b4f`](https://github.com/es-shims/Function.prototype.name/commit/a187b4fd07dbbeee12e8dc60651f122ab3f41f8d)
|
||||
- [Deps] update `define-properties`, `es-abstract` [`3ca42ef`](https://github.com/es-shims/Function.prototype.name/commit/3ca42ef76d5d4016d1ea87d806dc7e4a09d9b4f8)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`8de25d2`](https://github.com/es-shims/Function.prototype.name/commit/8de25d2b9b523bd385b0bf3bb9213c11ecf8f1ba)
|
||||
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `tape` [`8b04da7`](https://github.com/es-shims/Function.prototype.name/commit/8b04da71695a1b9cf285ee926ffeec55b543595b)
|
||||
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`39d8538`](https://github.com/es-shims/Function.prototype.name/commit/39d853854136a749c94e10f9fb06ba73903671a6)
|
||||
- [meta] reorder scripts [`054f96b`](https://github.com/es-shims/Function.prototype.name/commit/054f96b5e88e08e65c4e27bcb799c7cea2bc3462)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`bebee89`](https://github.com/es-shims/Function.prototype.name/commit/bebee894a7989aef6e9db0dc8b16cbd9134b629c)
|
||||
- [Dev Deps] update `aud`, `tape` [`8e68159`](https://github.com/es-shims/Function.prototype.name/commit/8e681599b4fbf26e921f61fd603da0524369b72c)
|
||||
- [Tests] handle Function.prototype in Opera 12.1 [`f3b8f9a`](https://github.com/es-shims/Function.prototype.name/commit/f3b8f9a40b88f6da5ad41b874c3f2acf6fb30378)
|
||||
- [Deps] update `es-abstract`, `functions-have-names` [`6a59889`](https://github.com/es-shims/Function.prototype.name/commit/6a598893f013182070479a8cc52afd44e556561f)
|
||||
- [Deps] update `define-properties`, `es-abstract` [`cd1c5e7`](https://github.com/es-shims/Function.prototype.name/commit/cd1c5e773c3740ec563a26e657d764aba7c35a8c)
|
||||
- [Deps] update `es-abstract` [`3584585`](https://github.com/es-shims/Function.prototype.name/commit/35845851109f767e3bc84ebef989ca93e5851276)
|
||||
- [Deps] update `es-abstract` [`0e2f6d9`](https://github.com/es-shims/Function.prototype.name/commit/0e2f6d99d554a8b6b7c835702c8408832f9a2684)
|
||||
- [Deps] update `es-abstract` [`b11748e`](https://github.com/es-shims/Function.prototype.name/commit/b11748ebbda2d840ac625ae6627cfdb090b94434)
|
||||
- [Dev Deps] update `tape` [`d787a81`](https://github.com/es-shims/Function.prototype.name/commit/d787a81a1e1ce6d00dda6272e93a43bb193b1286)
|
||||
- [Deps] update `es-abstract` [`4692639`](https://github.com/es-shims/Function.prototype.name/commit/469263915b07db8342f0aad29ad7eba083bea277)
|
||||
- [Dev Deps] add `in-publish` [`568e263`](https://github.com/es-shims/Function.prototype.name/commit/568e2635099de326768f40d9e0eacbd024861676)
|
||||
|
||||
<!-- auto-changelog-above -->
|
||||
1.1.5 / 2021-10-01
|
||||
=================
|
||||
* [Deps] update `es-abstract`
|
||||
* [meta] use `prepublishOnly` script for npm 7+
|
||||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `tape`
|
||||
* [actions] update workflows
|
||||
* [actions] use `node/install` instead of `node/run`; use `codecov` action
|
||||
|
||||
1.1.4 / 2021-02-22
|
||||
=================
|
||||
* [readme] remove travis badge
|
||||
* [meta] remove audit-level
|
||||
* [meta] gitignore coverage output
|
||||
* [meta] do not publish github action workflow files
|
||||
* [Deps] update `call-bind`, `es-abstract`, `functions-have-names`
|
||||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-strict-mode`, `tape`
|
||||
* [Tests] increase coverage
|
||||
* [actions] update workflows
|
||||
|
||||
1.1.3 / 2020-11-27
|
||||
=================
|
||||
* [Deps] update `es-abstract`, `functions-have-names`; use `call-bind` where applicable
|
||||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `make-arrow-function`, `make-generator-function`; add `aud`, `make-async-function`
|
||||
* [actions] add "Allow Edits" workflow
|
||||
* [actions] switch Automatic Rebase workflow to `pull_request_target` event
|
||||
* [Tests] migrate tests to Github Actions
|
||||
* [Tests] run `nyc` on all tests
|
||||
* [Tests] add `implementation` test; run `es-shim-api` in postlint; use `tape` runner
|
||||
* [Tests] only audit prod deps
|
||||
|
||||
1.1.2 / 2019-12-14
|
||||
=================
|
||||
* [Refactor] use `es-abstract`
|
||||
* [Deps] update `functions-have-names`
|
||||
* [meta] add `funding` field
|
||||
* [meta] fix repo capitalization
|
||||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`
|
||||
* [Tests] use shared travis-ci configs
|
||||
* [actions] add automatic rebasing / merge commit blocking
|
||||
|
||||
1.1.1 / 2019-07-24
|
||||
=================
|
||||
* [Refactor] use `functions-have-names`
|
||||
* [meta] clean up package.json scripts
|
||||
* [meta] update links
|
||||
* [meta] create FUNDING.yml
|
||||
* [Deps] update `is-callable`, `define-properties`
|
||||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `safe-publish-latest`, `covert`
|
||||
* [Tests] use `eccheck` over `editorconfig-tools`
|
||||
* [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops
|
||||
* [Tests] up to `node` `v11.7`, `v10.15`, `v9.11`, `v8.15`, `v6.16`, `v4.9`
|
||||
* [Test] remove `jscs`
|
||||
|
||||
1.1.0 / 2017-12-31
|
||||
=================
|
||||
* [New] add `auto` entry point
|
||||
* [Deps] update `function-bind`
|
||||
* [Dev Deps] update `uglify-register`, `tape`, `nsp`, `eslint`, `@ljharb/eslint-config`, `@es-shims/api`
|
||||
* [Tests] up to `node` `v9.3`, `v8.9`, `v6.12`; use `nvm install-latest-npm`; pin included builds to LTS
|
||||
|
||||
1.0.3 / 2017-07-21
|
||||
=================
|
||||
* [Fix] be robust against function name mangling
|
||||
* [Refactor] move function name detection to separate file
|
||||
|
||||
1.0.2 / 2017-07-14
|
||||
=================
|
||||
* [Refactor] shim: Remove unnecessary `!functionsHaveNames` check
|
||||
|
||||
1.0.1 / 2017-07-11
|
||||
=================
|
||||
* [Fix] in IE 9-11, we must rely on `.call` being available (#13)
|
||||
* [Fix] ensure that `Function.prototype.name` does not erase the getter
|
||||
* [Deps] update `is-callable`
|
||||
* [Dev Deps] add `safe-publish-latest`
|
||||
* [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `@es-shims/api`
|
||||
* [Tests] up to `node` `v8.1`; `v7.10`, `v6.11`, `v4.8`; improve matrix; newer npm fails on older nodes
|
||||
* [Tests] use `Object` to avoid function name inference in node 7
|
||||
|
||||
1.0.0 / 2016-02-27
|
||||
=================
|
||||
* Initial release.
|
||||
21
node_modules/function.prototype.name/LICENSE
generated
vendored
Normal file
21
node_modules/function.prototype.name/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Jordan Harband
|
||||
|
||||
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.
|
||||
55
node_modules/function.prototype.name/README.md
generated
vendored
Normal file
55
node_modules/function.prototype.name/README.md
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
# function.prototype.name <sup>[![Version Badge][2]][1]</sup>
|
||||
|
||||
[![dependency status][5]][6]
|
||||
[![dev dependency status][7]][8]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][11]][1]
|
||||
|
||||
An ES2015 spec-compliant `Function.prototype.name` shim. Invoke its "shim" method to shim Function.prototype.name if it is unavailable.
|
||||
*Note*: `Function#name` requires a true ES5 environment - specifically, one with ES5 getters.
|
||||
|
||||
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES5-supported environment and complies with the [spec](https://www.ecma-international.org/ecma-262/6.0/#sec-get-regexp.prototype.flags).
|
||||
|
||||
Most common usage:
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var functionName = require('function.prototype.name');
|
||||
var assert = require('assert');
|
||||
|
||||
assert.equal(functionName(function foo() {}), 'foo');
|
||||
|
||||
functionName.shim();
|
||||
assert.equal(function foo() {}.name, 'foo');
|
||||
```
|
||||
|
||||
## Supported engines
|
||||
Automatically tested in every minor version of node.
|
||||
|
||||
Manually tested in:
|
||||
- Safari: v4 - v15 <sub>(4, 5, 5.1, 6.0.5, 6.2, 7.1, 8, 9.1.3, 10.1.2, 11.1.2, 12.1, 13.1.2, 14.1.2, 15.3, 15.6.1)</sub>
|
||||
- Chrome: v15 - v81, v83 - v106<sub>(every integer version)</sub>
|
||||
- Note: This includes Edge v80+ and Opera v15+, which matches Chrome
|
||||
- Firefox: v3, v3.6, v4 - v105 <sub>(every integer version)</sub>
|
||||
- Note: in v42 - v63, `Function.prototype.toString` throws on HTML element constructors, or a Proxy to a function
|
||||
- Note: in v20 - v35, HTML element constructors are not callable, despite having typeof `function`
|
||||
- IE: v6 - v11<sub>(every integer version</sub>
|
||||
- Opera: v11.1, v11.5, v11.6, v12.0, v12.1, v12.14, v12.15, v12.16, v15+ <sub>v15+ matches Chrome</sub>
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[1]: https://npmjs.org/package/function.prototype.name
|
||||
[2]: https://versionbadg.es/es-shims/Function.prototype.name.svg
|
||||
[5]: https://david-dm.org/es-shims/Function.prototype.name.svg
|
||||
[6]: https://david-dm.org/es-shims/Function.prototype.name
|
||||
[7]: https://david-dm.org/es-shims/Function.prototype.name/dev-status.svg
|
||||
[8]: https://david-dm.org/es-shims/Function.prototype.name#info=devDependencies
|
||||
[11]: https://nodei.co/npm/function.prototype.name.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/function.prototype.name.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/function.prototype.name.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=function.prototype.name
|
||||
3
node_modules/function.prototype.name/auto.js
generated
vendored
Normal file
3
node_modules/function.prototype.name/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
5
node_modules/function.prototype.name/helpers/functionsHaveNames.js
generated
vendored
Normal file
5
node_modules/function.prototype.name/helpers/functionsHaveNames.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('functions-have-names')();
|
||||
|
||||
// TODO: semver-major, remove
|
||||
72
node_modules/function.prototype.name/implementation.js
generated
vendored
Normal file
72
node_modules/function.prototype.name/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
'use strict';
|
||||
|
||||
var IsCallable = require('is-callable');
|
||||
var hasOwn = require('hasown');
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
var callBound = require('call-bound');
|
||||
var $functionToString = callBound('Function.prototype.toString');
|
||||
var $stringMatch = callBound('String.prototype.match');
|
||||
var toStr = callBound('Object.prototype.toString');
|
||||
|
||||
var classRegex = /^class /;
|
||||
|
||||
var isClass = function isClassConstructor(fn) {
|
||||
if (IsCallable(fn)) {
|
||||
return false;
|
||||
}
|
||||
if (typeof fn !== 'function') {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
var match = $stringMatch($functionToString(fn), classRegex);
|
||||
return !!match;
|
||||
} catch (e) {}
|
||||
return false;
|
||||
};
|
||||
|
||||
var regex = /\s*function\s+([^(\s]*)\s*/;
|
||||
|
||||
var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing
|
||||
|
||||
var objectClass = '[object Object]';
|
||||
var ddaClass = '[object HTMLAllCollection]';
|
||||
|
||||
var functionProto = Function.prototype;
|
||||
|
||||
var isDDA = function isDocumentDotAll() {
|
||||
return false;
|
||||
};
|
||||
if (typeof document === 'object') {
|
||||
// Firefox 3 canonicalizes DDA to undefined when it's not accessed directly
|
||||
var all = document.all;
|
||||
if (toStr(all) === toStr(document.all)) {
|
||||
isDDA = function isDocumentDotAll(value) {
|
||||
/* globals document: false */
|
||||
// in IE 6-8, typeof document.all is "object" and it's truthy
|
||||
if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {
|
||||
try {
|
||||
var str = toStr(value);
|
||||
// IE 6-8 uses `objectClass`
|
||||
return (str === ddaClass || str === objectClass) && value('') == null; // eslint-disable-line eqeqeq
|
||||
} catch (e) { /**/ }
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function getName() {
|
||||
if (isDDA(this) || (!isClass(this) && !IsCallable(this))) {
|
||||
throw new TypeError('Function.prototype.name sham getter called on non-function');
|
||||
}
|
||||
if (functionsHaveNames && hasOwn(this, 'name')) {
|
||||
return this.name;
|
||||
}
|
||||
if (this === functionProto) {
|
||||
return '';
|
||||
}
|
||||
var str = $functionToString(this);
|
||||
var match = $stringMatch(str, regex);
|
||||
var name = match && match[1];
|
||||
return name;
|
||||
};
|
||||
18
node_modules/function.prototype.name/index.js
generated
vendored
Normal file
18
node_modules/function.prototype.name/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var bound = callBind(implementation);
|
||||
|
||||
define(bound, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = bound;
|
||||
101
node_modules/function.prototype.name/package.json
generated
vendored
Normal file
101
node_modules/function.prototype.name/package.json
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"name": "function.prototype.name",
|
||||
"version": "1.1.8",
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"description": "An ES2015 spec-compliant `Function.prototype.name` shim",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run --silent tests-only",
|
||||
"posttest": "npx npm@'>=10.2' audit --production",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"postlint": "es-shim-api --bound",
|
||||
"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://github.com/es-shims/Function.prototype.name.git"
|
||||
},
|
||||
"keywords": [
|
||||
"Function.prototype.name",
|
||||
"function",
|
||||
"name",
|
||||
"ES6",
|
||||
"ES2015",
|
||||
"shim",
|
||||
"polyfill",
|
||||
"es-shim API"
|
||||
],
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.8",
|
||||
"call-bound": "^1.0.3",
|
||||
"define-properties": "^1.2.1",
|
||||
"functions-have-names": "^1.2.3",
|
||||
"hasown": "^2.0.2",
|
||||
"is-callable": "^1.2.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@es-shims/api": "^2.5.1",
|
||||
"@ljharb/eslint-config": "^21.1.1",
|
||||
"auto-changelog": "^2.5.0",
|
||||
"eclint": "^2.8.1",
|
||||
"encoding": "^0.1.13",
|
||||
"eslint": "=8.8.0",
|
||||
"for-each": "^0.3.3",
|
||||
"has-strict-mode": "^1.0.1",
|
||||
"in-publish": "^2.0.1",
|
||||
"make-arrow-function": "^1.2.0",
|
||||
"make-async-function": "^1.0.0",
|
||||
"make-generator-function": "^2.0.0",
|
||||
"npmignore": "^0.3.1",
|
||||
"nyc": "^10.3.2",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.9.0",
|
||||
"uglify-register": "^1.0.1"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js",
|
||||
"browsers": [
|
||||
"iexplore/9.0..latest",
|
||||
"firefox/4.0..6.0",
|
||||
"firefox/15.0..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/4.0..10.0",
|
||||
"chrome/20.0..latest",
|
||||
"chrome/canary",
|
||||
"opera/11.6..latest",
|
||||
"opera/next",
|
||||
"safari/5.0..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true,
|
||||
"startingVersion": "v1.1.6"
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows"
|
||||
]
|
||||
}
|
||||
}
|
||||
7
node_modules/function.prototype.name/polyfill.js
generated
vendored
Normal file
7
node_modules/function.prototype.name/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return implementation;
|
||||
};
|
||||
35
node_modules/function.prototype.name/shim.js
generated
vendored
Normal file
35
node_modules/function.prototype.name/shim.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
var supportsDescriptors = require('define-properties').supportsDescriptors;
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
var getPolyfill = require('./polyfill');
|
||||
var defineProperty = Object.defineProperty;
|
||||
var TypeErr = TypeError;
|
||||
|
||||
module.exports = function shimName() {
|
||||
var polyfill = getPolyfill();
|
||||
if (functionsHaveNames) {
|
||||
return polyfill;
|
||||
}
|
||||
if (!supportsDescriptors) {
|
||||
throw new TypeErr('Shimming Function.prototype.name support requires ES5 property descriptor support.');
|
||||
}
|
||||
var functionProto = Function.prototype;
|
||||
defineProperty(functionProto, 'name', {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
get: function () {
|
||||
var name = polyfill.call(this);
|
||||
if (this !== functionProto) {
|
||||
defineProperty(this, 'name', {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value: name,
|
||||
writable: false
|
||||
});
|
||||
}
|
||||
return name;
|
||||
}
|
||||
});
|
||||
return polyfill;
|
||||
};
|
||||
20
node_modules/function.prototype.name/test/implementation.js
generated
vendored
Normal file
20
node_modules/function.prototype.name/test/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('../implementation');
|
||||
var callBind = require('call-bind');
|
||||
var test = require('tape');
|
||||
var hasStrictMode = require('has-strict-mode')();
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('as a function', function (t) {
|
||||
t.test('bad array/this value', { skip: !hasStrictMode }, function (st) {
|
||||
/* eslint no-useless-call: 0 */
|
||||
st['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(callBind(implementation), t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
23
node_modules/function.prototype.name/test/index.js
generated
vendored
Normal file
23
node_modules/function.prototype.name/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
var getName = require('../');
|
||||
var test = require('tape');
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('as a function', function (t) {
|
||||
t.test('non-functions', function (st) {
|
||||
st['throws'](function () { getName(); }, TypeError, 'undefined is not a function');
|
||||
st['throws'](function () { getName(null); }, TypeError, 'null is not a function');
|
||||
st['throws'](function () { getName(true); }, TypeError, 'true is not a function');
|
||||
st['throws'](function () { getName(false); }, TypeError, 'false is not a function');
|
||||
st['throws'](function () { getName('foo'); }, TypeError, '"foo" is not a function');
|
||||
st['throws'](function () { getName([]); }, TypeError, '[] is not a function');
|
||||
st['throws'](function () { getName({}); }, TypeError, '{} is not a function');
|
||||
st['throws'](function () { getName(/a/g); }, TypeError, '/a/g is not a function');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(getName, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
21
node_modules/function.prototype.name/test/shimmed.js
generated
vendored
Normal file
21
node_modules/function.prototype.name/test/shimmed.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
require('../auto');
|
||||
|
||||
var test = require('tape');
|
||||
var supportsDescriptors = require('define-properties').supportsDescriptors;
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('shimmed', function (t) {
|
||||
t.test('enumerability', { skip: !supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(Function.prototype, 'name'), 'Function#name is not enumerable');
|
||||
et.equal(false, isEnumerable.call(function foo() {}, 'name'), 'a function’s name is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
runTests(function (fn) { return fn.name; }, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
104
node_modules/function.prototype.name/test/tests.js
generated
vendored
Normal file
104
node_modules/function.prototype.name/test/tests.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
'use strict';
|
||||
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
var arrows = require('make-arrow-function').list();
|
||||
var generators = require('make-generator-function')();
|
||||
var asyncs = require('make-async-function').list();
|
||||
var IsCallable = require('is-callable');
|
||||
var forEach = require('for-each');
|
||||
|
||||
var foo = Object(function foo() {});
|
||||
var anon = Object(function () {});
|
||||
var evalled = Object(Function()); // eslint-disable-line no-new-func
|
||||
|
||||
module.exports = function (getName, t) {
|
||||
t.test('functions', function (st) {
|
||||
if (functionsHaveNames) {
|
||||
st.equal(getName(foo), foo.name, 'foo has name "foo"');
|
||||
st.equal(getName(anon), anon.name, 'anonymous function has name of empty string');
|
||||
st.equal(getName(evalled), evalled.name, 'eval-d function has name "anonymous" (or empty string)');
|
||||
}
|
||||
st.equal(getName(foo), 'foo', 'foo has name "foo"');
|
||||
st.equal(getName(anon), '', 'anonymous function has name of empty string');
|
||||
var evalledName = getName(evalled);
|
||||
st.equal(evalledName === 'anonymous' || evalledName === '', true, 'eval-d function has name "anonymous" (or empty string');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('arrow functions', { skip: arrows.length === 0 }, function (st) {
|
||||
st.equal(true, functionsHaveNames, 'functions have names in any env with arrow functions');
|
||||
forEach(arrows, function (arrowFn) {
|
||||
st.equal(getName(arrowFn), arrowFn.name, 'arrow function name matches for ' + arrowFn);
|
||||
});
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('generators', { skip: generators.length === 0 }, function (st) {
|
||||
st.equal(true, functionsHaveNames, 'functions have names in any env with generator functions');
|
||||
forEach(generators, function (genFn) {
|
||||
st.equal(getName(genFn), genFn.name, 'generator function name matches for ' + genFn);
|
||||
});
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('asyncs', { skip: asyncs.length === 0 }, function (st) {
|
||||
st.equal(true, functionsHaveNames, 'functions have names in any env with async functions');
|
||||
forEach(asyncs, function (asyncFn) {
|
||||
st.equal(getName(asyncFn), asyncFn.name, 'async function name matches for ' + asyncFn);
|
||||
});
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('Function.prototype.name', function (st) {
|
||||
st.equal(getName(function before() {}), 'before', 'function prior to accessing Function.prototype has the right name');
|
||||
var protoName = getName(Function.prototype);
|
||||
// on <= node v2.5, this is "Empty"; on Opera 12.1, "Function.prototype" - otherwise, the empty string
|
||||
st.equal(protoName === '' || protoName === 'Empty' || protoName === 'Function.prototype', true, 'Function.prototype has the right name');
|
||||
st.equal(getName(function after() {}), 'after', 'function after accessing Function.prototype has the right name');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('DOM', function (st) {
|
||||
/* eslint-env browser */
|
||||
|
||||
st.test('document.all', { skip: typeof document !== 'object' }, function (s2t) {
|
||||
s2t['throws'](
|
||||
function () { getName(document.all); },
|
||||
TypeError,
|
||||
'a document.all has no name'
|
||||
);
|
||||
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
forEach([
|
||||
'HTMLElement',
|
||||
'HTMLAnchorElement'
|
||||
], function (name) {
|
||||
var constructor = global[name];
|
||||
|
||||
st.test(name, { skip: !constructor }, function (s2t) {
|
||||
s2t.match(typeof constructor, /^(?:function|object)$/, name + ' is a function or an object');
|
||||
|
||||
if (IsCallable(constructor)) {
|
||||
try {
|
||||
s2t.equal(getName(constructor), name, name + ' has the right name');
|
||||
} catch (e) {
|
||||
s2t.fail(e);
|
||||
}
|
||||
} else {
|
||||
s2t['throws'](
|
||||
function () { getName(constructor); },
|
||||
TypeError,
|
||||
name + ' is not callable'
|
||||
);
|
||||
}
|
||||
|
||||
s2t.end();
|
||||
});
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
};
|
||||
17
node_modules/function.prototype.name/test/uglified.js
generated
vendored
Normal file
17
node_modules/function.prototype.name/test/uglified.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('with uglify', function (t) {
|
||||
/* eslint global-require: 0 */
|
||||
require('uglify-register/api').register({
|
||||
exclude: [/\/node_modules\//, /\/test\//],
|
||||
uglify: { mangle: true }
|
||||
});
|
||||
|
||||
var getName = require('../');
|
||||
runTests(getName, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
Reference in New Issue
Block a user