source: trip-planner-front/node_modules/core-js/modules/es.function.name.js@ 8d391a1

Last change on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 673 bytes
Line 
1var DESCRIPTORS = require('../internals/descriptors');
2var defineProperty = require('../internals/object-define-property').f;
3
4var FunctionPrototype = Function.prototype;
5var FunctionPrototypeToString = FunctionPrototype.toString;
6var nameRE = /^\s*function ([^ (]*)/;
7var NAME = 'name';
8
9// Function instances `.name` property
10// https://tc39.es/ecma262/#sec-function-instances-name
11if (DESCRIPTORS && !(NAME in FunctionPrototype)) {
12 defineProperty(FunctionPrototype, NAME, {
13 configurable: true,
14 get: function () {
15 try {
16 return FunctionPrototypeToString.call(this).match(nameRE)[1];
17 } catch (error) {
18 return '';
19 }
20 }
21 });
22}
Note: See TracBrowser for help on using the repository browser.