mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-21 15:25:09 +00:00
20 lines
429 B
JavaScript
20 lines
429 B
JavaScript
/*!
|
|
* Chai - getName utility
|
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
* MIT Licensed
|
|
*/
|
|
|
|
/**
|
|
* # getName(func)
|
|
*
|
|
* Gets the name of a function, in a cross-browser way.
|
|
*
|
|
* @param {Function} a function (usually a constructor)
|
|
*/
|
|
|
|
module.exports = function (func) {
|
|
if (func.name) return func.name;
|
|
|
|
var match = /^\s?function ([^(]*)\(/.exec(func);
|
|
return match && match[1] ? match[1] : "";
|
|
};
|