function.prototype.name
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -0,1 +1,5 @@ | ||
1.0.2 / 2017-07-14 | ||
================= | ||
* [Refactor] shim: Remove unnecessary `!functionsHaveNames` check | ||
1.0.1 / 2017-07-11 | ||
@@ -2,0 +6,0 @@ ================= |
{ | ||
"name": "function.prototype.name", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"author": "Jordan Harband", | ||
@@ -5,0 +5,0 @@ "description": "An ES6 spec-compliant `Function.prototype.name` shim", |
34
shim.js
@@ -17,22 +17,20 @@ 'use strict'; | ||
} | ||
if (function foo() {}.name !== 'foo') { | ||
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; | ||
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; | ||
}; |
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
22566
289