You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					23 lines
				
				680 B
			
		
		
			
		
	
	
					23 lines
				
				680 B
			| 
								 
											4 years ago
										 
									 | 
							
								var DESCRIPTORS = require('../internals/descriptors');
							 | 
						||
| 
								 | 
							
								var defineProperty = require('../internals/object-define-property').f;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								var FunctionPrototype = Function.prototype;
							 | 
						||
| 
								 | 
							
								var FunctionPrototypeToString = FunctionPrototype.toString;
							 | 
						||
| 
								 | 
							
								var nameRE = /^\s*function ([^ (]*)/;
							 | 
						||
| 
								 | 
							
								var NAME = 'name';
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// Function instances `.name` property
							 | 
						||
| 
								 | 
							
								// https://tc39.github.io/ecma262/#sec-function-instances-name
							 | 
						||
| 
								 | 
							
								if (DESCRIPTORS && !(NAME in FunctionPrototype)) {
							 | 
						||
| 
								 | 
							
								  defineProperty(FunctionPrototype, NAME, {
							 | 
						||
| 
								 | 
							
								    configurable: true,
							 | 
						||
| 
								 | 
							
								    get: function () {
							 | 
						||
| 
								 | 
							
								      try {
							 | 
						||
| 
								 | 
							
								        return FunctionPrototypeToString.call(this).match(nameRE)[1];
							 | 
						||
| 
								 | 
							
								      } catch (error) {
							 | 
						||
| 
								 | 
							
								        return '';
							 | 
						||
| 
								 | 
							
								      }
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								  });
							 | 
						||
| 
								 | 
							
								}
							 |