Bump eslint-plugin-import to avoid vulnerability in dependency
This commit is contained in:
parent
10695e6a20
commit
ed9506bbaf
1660 changed files with 67726 additions and 27926 deletions
20
node_modules/function.prototype.name/.editorconfig
generated
vendored
Normal file
20
node_modules/function.prototype.name/.editorconfig
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
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 = 150
|
||||
|
||||
[CHANGELOG.md]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.json]
|
||||
max_line_length = off
|
||||
|
||||
[Makefile]
|
||||
max_line_length = off
|
||||
1
node_modules/function.prototype.name/.eslintignore
generated
vendored
Normal file
1
node_modules/function.prototype.name/.eslintignore
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
coverage/
|
||||
9
node_modules/function.prototype.name/.eslintrc
generated
vendored
Normal file
9
node_modules/function.prototype.name/.eslintrc
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"new-cap": [2, { "capIsNewExceptions": ["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"
|
||||
]
|
||||
}
|
||||
82
node_modules/function.prototype.name/CHANGELOG.md
generated
vendored
Normal file
82
node_modules/function.prototype.name/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
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.
|
||||
42
node_modules/function.prototype.name/README.md
generated
vendored
Normal file
42
node_modules/function.prototype.name/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# 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');
|
||||
```
|
||||
|
||||
## 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
|
||||
43
node_modules/function.prototype.name/implementation.js
generated
vendored
Normal file
43
node_modules/function.prototype.name/implementation.js
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
'use strict';
|
||||
|
||||
var IsCallable = require('es-abstract/2021/IsCallable');
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
var callBound = require('call-bind/callBound');
|
||||
var $functionToString = callBound('Function.prototype.toString');
|
||||
var $stringMatch = callBound('String.prototype.match');
|
||||
|
||||
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 functionProto = Function.prototype;
|
||||
|
||||
module.exports = function getName() {
|
||||
if (!isClass(this) && !IsCallable(this)) {
|
||||
throw new TypeError('Function.prototype.name sham getter called on non-function');
|
||||
}
|
||||
if (functionsHaveNames) {
|
||||
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;
|
||||
80
node_modules/function.prototype.name/package.json
generated
vendored
Normal file
80
node_modules/function.prototype.name/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"name": "function.prototype.name",
|
||||
"version": "1.1.5",
|
||||
"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": {
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run --silent tests-only",
|
||||
"posttest": "aud --production",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"prelint": "npm run eccheck",
|
||||
"lint": "eslint .",
|
||||
"postlint": "es-shim-api --bound",
|
||||
"eccheck": "eclint check '*.js' '**/*.js'"
|
||||
},
|
||||
"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.2",
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.19.0",
|
||||
"functions-have-names": "^1.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@es-shims/api": "^2.2.1",
|
||||
"@ljharb/eslint-config": "^18.0.0",
|
||||
"aud": "^1.1.5",
|
||||
"eclint": "^2.8.1",
|
||||
"eslint": "^7.32.0",
|
||||
"for-each": "^0.3.3",
|
||||
"has-strict-mode": "^1.0.1",
|
||||
"make-arrow-function": "^1.2.0",
|
||||
"make-async-function": "^1.0.0",
|
||||
"make-generator-function": "^2.0.0",
|
||||
"nyc": "^10.3.2",
|
||||
"safe-publish-latest": "^1.1.4",
|
||||
"tape": "^5.3.1",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
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();
|
||||
});
|
||||
60
node_modules/function.prototype.name/test/tests.js
generated
vendored
Normal file
60
node_modules/function.prototype.name/test/tests.js
generated
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
'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 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" - otherwise, the empty string
|
||||
st.equal(protoName === '' || protoName === 'Empty', true, 'Function.prototype has the right name');
|
||||
st.equal(getName(function after() {}), 'after', 'function after accessing Function.prototype has the right name');
|
||||
|
||||
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();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue