Version 1
[yaffs-website] / node_modules / core-js / modules / es6.function.name.js
1 var dP         = require('./_object-dp').f
2   , createDesc = require('./_property-desc')
3   , has        = require('./_has')
4   , FProto     = Function.prototype
5   , nameRE     = /^\s*function ([^ (]*)/
6   , NAME       = 'name';
7
8 var isExtensible = Object.isExtensible || function(){
9   return true;
10 };
11
12 // 19.2.4.2 name
13 NAME in FProto || require('./_descriptors') && dP(FProto, NAME, {
14   configurable: true,
15   get: function(){
16     try {
17       var that = this
18         , name = ('' + that).match(nameRE)[1];
19       has(that, NAME) || !isExtensible(that) || dP(that, NAME, createDesc(5, name));
20       return name;
21     } catch(e){
22       return '';
23     }
24   }
25 });