@splitsoftware/splitio-commons
Version:
Split JavaScript SDK common components
13 lines (12 loc) • 322 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFnName = void 0;
/**
* Returns the name of a given function.
*/
function getFnName(fn) {
if (fn.name)
return fn.name;
return (fn.toString().match(/function (.+?)\(/) || ['', ''])[1];
}
exports.getFnName = getFnName;