source: imaps-frontend/node_modules/core-js/modules/es.function.name.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 914 bytes
Line 
1'use strict';
2var DESCRIPTORS = require('../internals/descriptors');
3var FUNCTION_NAME_EXISTS = require('../internals/function-name').EXISTS;
4var uncurryThis = require('../internals/function-uncurry-this');
5var defineBuiltInAccessor = require('../internals/define-built-in-accessor');
6
7var FunctionPrototype = Function.prototype;
8var functionToString = uncurryThis(FunctionPrototype.toString);
9var nameRE = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/;
10var regExpExec = uncurryThis(nameRE.exec);
11var NAME = 'name';
12
13// Function instances `.name` property
14// https://tc39.es/ecma262/#sec-function-instances-name
15if (DESCRIPTORS && !FUNCTION_NAME_EXISTS) {
16 defineBuiltInAccessor(FunctionPrototype, NAME, {
17 configurable: true,
18 get: function () {
19 try {
20 return regExpExec(nameRE, functionToString(this))[1];
21 } catch (error) {
22 return '';
23 }
24 }
25 });
26}
Note: See TracBrowser for help on using the repository browser.