MCPcopy
hub / github.com/microsoft/SandDance / getName

Function getName

docs/tests/v2/es6/js/sanddance.js:8379–8389  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

8377var regex = /\s*function\s+([^\(\s]*)\s*/;
8378// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
8379function getName(func) {
8380 if (!util.isFunction(func)) {
8381 return;
8382 }
8383 if (functionsHaveNames) {
8384 return func.name;
8385 }
8386 var str = func.toString();
8387 var match = str.match(regex);
8388 return match && match[1];
8389}
8390assert.AssertionError = function AssertionError(options) {
8391 this.name = 'AssertionError';
8392 this.actual = options.actual;

Callers 2

sanddance.jsFile · 0.85
inspectFunction · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected