(node: Node, context: ResolutionContext)
| 831 | |
| 832 | /** A declarator's own source text: `B = lazy(…)` in `const A = lazy(…), B = lazy(…)`. */ |
| 833 | export function declarationText(node: Node, context: ResolutionContext): string { |
| 834 | const lines = (context.getFileLines?.(node.filePath) ?? context.readFile(node.filePath)?.split(/\r?\n/) ?? []) |
| 835 | .slice(node.startLine - 1, node.endLine); |
| 836 | if (lines.length === 0) return ''; |
| 837 | if (node.endColumn > 0) lines[lines.length - 1] = lines[lines.length - 1]!.slice(0, node.endColumn); |
| 838 | lines[0] = lines[0]!.slice(node.startColumn); |
| 839 | return lines.join('\n'); |
| 840 | } |
| 841 | |
| 842 | /** |
| 843 | * The component a value wraps, which is what it renders: the function it |
no test coverage detected