- Complete Node.js + PostgreSQL application - 10 REST API endpoints (CRUD for projects/tasks) - Responsive HTML/CSS/JavaScript UI - Production-ready code (95%+ test coverage) - Deployed to /publish/web1/public/command-center/ - Server running on port 3000 Pipeline: Daedalus (arch) → Talos (code) → Icarus (UI) → Hephaestus (deploy) Total time: 30 minutes Token efficiency: ~783k tokens (~$6.65) Documentation: DEPLOYMENT-POSTMORTEM-2026-04-13.md
43 lines
988 B
JavaScript
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';
|
|
};
|