MCPcopy Create free account
hub / github.com/RubyLouvre/anu / getName

Function getName

test/babel.js:6091–6101  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

6089 var regex = /\s*function\s+([^\(\s]*)\s*/;
6090 // based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
6091 function getName(func) {
6092 if (!util.isFunction(func)) {
6093 return;
6094 }
6095 if (functionsHaveNames) {
6096 return func.name;
6097 }
6098 var str = func.toString();
6099 var match = str.match(regex);
6100 return match && match[1];
6101 }
6102 assert.AssertionError = function AssertionError(options) {
6103 this.name = 'AssertionError';
6104 this.actual = options.actual;

Callers 2

babel.jsFile · 0.70
inspectFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected