function.prototype.name
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -0,1 +1,11 @@ | ||
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 | ||
@@ -2,0 +12,0 @@ ================= |
'use strict'; | ||
var isCallable = require('is-callable'); | ||
var IsCallable = require('es-abstract/2019/IsCallable'); | ||
var functionsHaveNames = require('functions-have-names')(); | ||
var bind = require('function-bind'); | ||
var functionToString = bind.call(Function.call, Function.prototype.toString); | ||
var stringMatch = bind.call(Function.call, String.prototype.match); | ||
var callBound = require('es-abstract/helpers/callBound'); | ||
var $functionToString = callBound('Function.prototype.toString'); | ||
var $stringMatch = callBound('String.prototype.match'); | ||
@@ -12,3 +12,3 @@ var classRegex = /^class /; | ||
var isClass = function isClassConstructor(fn) { | ||
if (isCallable(fn)) { | ||
if (IsCallable(fn)) { | ||
return false; | ||
@@ -20,3 +20,3 @@ } | ||
try { | ||
var match = stringMatch(functionToString(fn), classRegex); | ||
var match = $stringMatch($functionToString(fn), classRegex); | ||
return !!match; | ||
@@ -32,3 +32,3 @@ } catch (e) {} | ||
module.exports = function getName() { | ||
if (!isClass(this) && !isCallable(this)) { | ||
if (!isClass(this) && !IsCallable(this)) { | ||
throw new TypeError('Function.prototype.name sham getter called on non-function'); | ||
@@ -42,6 +42,6 @@ } | ||
} | ||
var str = functionToString(this); | ||
var match = stringMatch(str, regex); | ||
var str = $functionToString(this); | ||
var match = $stringMatch(str, regex); | ||
var name = match && match[1]; | ||
return name; | ||
}; |
'use strict'; | ||
var define = require('define-properties'); | ||
var bind = require('function-bind'); | ||
var callBind = require('es-abstract/helpers/callBind'); | ||
@@ -10,3 +10,3 @@ var implementation = require('./implementation'); | ||
var bound = bind.call(Function.call, implementation); | ||
var bound = callBind(implementation); | ||
@@ -13,0 +13,0 @@ define(bound, { |
{ | ||
"name": "function.prototype.name", | ||
"version": "1.1.1", | ||
"author": "Jordan Harband", | ||
"description": "An ES6 spec-compliant `Function.prototype.name` shim", | ||
"version": "1.1.2", | ||
"author": "Jordan Harband <ljharb@gmail.com>", | ||
"funding": { | ||
"url": "https://github.com/sponsors/ljharb" | ||
}, | ||
"description": "An ES2015 spec-compliant `Function.prototype.name` shim", | ||
"license": "MIT", | ||
@@ -20,8 +23,10 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "git://github.com/es-shims/function.prototype.name.git" | ||
"url": "git://github.com/es-shims/Function.prototype.name.git" | ||
}, | ||
"keywords": [ | ||
"Function.prototype.name", | ||
"function", | ||
"name", | ||
"ES6", | ||
"ES2015", | ||
"shim", | ||
@@ -33,15 +38,14 @@ "polyfill", | ||
"define-properties": "^1.1.3", | ||
"function-bind": "^1.1.1", | ||
"functions-have-names": "^1.1.1", | ||
"is-callable": "^1.1.4" | ||
"es-abstract": "^1.17.0-next.1", | ||
"functions-have-names": "^1.2.0" | ||
}, | ||
"devDependencies": { | ||
"@es-shims/api": "^2.1.2", | ||
"@ljharb/eslint-config": "^13.1.1", | ||
"@ljharb/eslint-config": "^15.0.2", | ||
"covert": "^1.1.1", | ||
"eclint": "^2.8.1", | ||
"eslint": "^5.16.0", | ||
"eslint": "^6.7.2", | ||
"make-arrow-function": "^1.1.0", | ||
"make-generator-function": "^1.1.0", | ||
"safe-publish-latest": "^1.1.2", | ||
"safe-publish-latest": "^1.1.4", | ||
"tape": "^4.11.0", | ||
@@ -48,0 +52,0 @@ "uglify-register": "^1.0.1" |
@@ -11,3 +11,3 @@ # function.prototype.name <sup>[![Version Badge][2]][1]</sup> | ||
An ES6 spec-compliant `Function.prototype.name` shim. Invoke its "shim" method to shim Function.prototype.name if it is unavailable. | ||
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. | ||
@@ -35,9 +35,9 @@ | ||
[1]: https://npmjs.org/package/function.prototype.name | ||
[2]: http://versionbadg.es/es-shims/function.prototype.name.svg | ||
[3]: https://travis-ci.org/es-shims/function.prototype.name.svg | ||
[4]: https://travis-ci.org/es-shims/function.prototype.name | ||
[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 | ||
[2]: http://versionbadg.es/es-shims/Function.prototype.name.svg | ||
[3]: https://travis-ci.org/es-shims/Function.prototype.name.svg | ||
[4]: https://travis-ci.org/es-shims/Function.prototype.name | ||
[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 | ||
@@ -44,0 +44,0 @@ [license-image]: http://img.shields.io/npm/l/function.prototype.name.svg |
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
3
14944
18
+ Addedes-abstract@^1.17.0-next.1
+ 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.7(transitive)
+ Addeddata-view-buffer@1.0.1(transitive)
+ Addeddata-view-byte-length@1.0.1(transitive)
+ Addeddata-view-byte-offset@1.0.0(transitive)
+ Addedes-abstract@1.23.3(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedes-set-tostringtag@2.0.3(transitive)
+ Addedes-to-primitive@1.2.1(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfunction.prototype.name@1.1.6(transitive)
+ Addedget-symbol-description@1.0.2(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedhas-bigints@1.0.2(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedinternal-slot@1.0.7(transitive)
+ Addedis-array-buffer@3.0.4(transitive)
+ Addedis-bigint@1.0.4(transitive)
+ Addedis-boolean-object@1.1.2(transitive)
+ Addedis-data-view@1.0.1(transitive)
+ Addedis-date-object@1.0.5(transitive)
+ Addedis-negative-zero@2.0.3(transitive)
+ Addedis-number-object@1.0.7(transitive)
+ Addedis-regex@1.1.4(transitive)
+ Addedis-shared-array-buffer@1.0.3(transitive)
+ Addedis-string@1.0.7(transitive)
+ Addedis-symbol@1.0.4(transitive)
+ Addedis-typed-array@1.1.13(transitive)
+ Addedis-weakref@1.0.2(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedobject-inspect@1.13.2(transitive)
+ Addedobject.assign@4.1.5(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedregexp.prototype.flags@1.5.3(transitive)
+ Addedsafe-array-concat@1.1.2(transitive)
+ Addedsafe-regex-test@1.0.3(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedstring.prototype.trim@1.2.9(transitive)
+ Addedstring.prototype.trimend@1.0.8(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.2(transitive)
+ Addedtyped-array-length@1.0.6(transitive)
+ Addedunbox-primitive@1.0.2(transitive)
+ Addedwhich-boxed-primitive@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.15(transitive)
- Removedfunction-bind@^1.1.1
- Removedis-callable@^1.1.4
Updatedfunctions-have-names@^1.2.0