agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
17 lines (15 loc) • 522 B
JavaScript
/**
* @file Extract block name from AST node
* @description Single responsibility: Determine the name of a code block from its AST node
*/
/**
* Extract block name from AST node
*/
function extractBlockName(node, type) {
if (node.id && node.id.name) return node.id.name;
if (node.key && node.key.name) return node.key.name;
if (node.left && node.left.property) return node.left.property.name;
if (type === 'reactComponent') return 'ReactComponent';
return 'anonymous';
}
module.exports = extractBlockName;