aboutsummaryrefslogtreecommitdiff
path: root/node_modules/core-js/modules/es6.function.name.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/core-js/modules/es6.function.name.js')
-rw-r--r--node_modules/core-js/modules/es6.function.name.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/node_modules/core-js/modules/es6.function.name.js b/node_modules/core-js/modules/es6.function.name.js
new file mode 100644
index 000000000..f824d86d2
--- /dev/null
+++ b/node_modules/core-js/modules/es6.function.name.js
@@ -0,0 +1,25 @@
+var dP = require('./_object-dp').f
+ , createDesc = require('./_property-desc')
+ , has = require('./_has')
+ , FProto = Function.prototype
+ , nameRE = /^\s*function ([^ (]*)/
+ , NAME = 'name';
+
+var isExtensible = Object.isExtensible || function(){
+ return true;
+};
+
+// 19.2.4.2 name
+NAME in FProto || require('./_descriptors') && dP(FProto, NAME, {
+ configurable: true,
+ get: function(){
+ try {
+ var that = this
+ , name = ('' + that).match(nameRE)[1];
+ has(that, NAME) || !isExtensible(that) || dP(that, NAME, createDesc(5, name));
+ return name;
+ } catch(e){
+ return '';
+ }
+ }
+}); \ No newline at end of file