Files
url_tracker_tool/node_modules/fn.name/index.js
Andrei 58f8093689 Rebrand from 'Redirect Intelligence v2' to 'URL Tracker Tool V2' throughout UI
- Updated all component headers and documentation
- Changed navbar and footer branding
- Updated homepage hero badge
- Modified page title in index.html
- Simplified footer text to 'Built with ❤️'
- Consistent V2 capitalization across all references
2025-08-19 19:12:23 +00:00

43 lines
988 B
JavaScript

'use strict';
var toString = Object.prototype.toString;
/**
* Extract names from functions.
*
* @param {Function} fn The function who's name we need to extract.
* @returns {String} The name of the function.
* @public
*/
module.exports = function name(fn) {
if ('string' === typeof fn.displayName && fn.constructor.name) {
return fn.displayName;
} else if ('string' === typeof fn.name && fn.name) {
return fn.name;
}
//
// Check to see if the constructor has a name.
//
if (
'object' === typeof fn
&& fn.constructor
&& 'string' === typeof fn.constructor.name
) return fn.constructor.name;
//
// toString the given function and attempt to parse it out of it, or determine
// the class.
//
var named = fn.toString()
, type = toString.call(fn).slice(8, -1);
if ('Function' === type) {
named = named.substring(named.indexOf('(') + 1, named.indexOf(')'));
} else {
named = type;
}
return named || 'anonymous';
};