UNPKG

agentsqripts

Version:

Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems

22 lines (18 loc) 533 B
/** * @file Extract code snippet from node * @description Single responsibility: Extract source code text from an AST node */ /** * Extract code snippet from a node * @param {Object} node - AST node * @param {string} source - Source code * @returns {string} Code snippet */ function getNodeCode(node, source) { if (!node || !source) return ''; if (typeof node.start === 'number' && typeof node.end === 'number') { return source.substring(node.start, node.end); } return ''; } module.exports = getNodeCode;