MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / stringLitValue

Function stringLitValue

src/extraction/languages/terraform.ts:42–48  ·  view source on GitHub ↗

Read a string_lit value (skipping the quotes / template start/end tokens).

(node: SyntaxNode, source: string)

Source from the content-addressed store, hash-verified

40
41/** Read a string_lit value (skipping the quotes / template start/end tokens). */
42function stringLitValue(node: SyntaxNode, source: string): string {
43 const literal = node.namedChildren.find((c) => c?.type === 'template_literal');
44 if (literal) return getNodeText(literal, source);
45 // Empty string ("") parses as quoted_template_start + quoted_template_end
46 // with no template_literal — return empty.
47 return '';
48}
49
50/** Block "type" and its label values. Returns null if the block is malformed. */
51function readBlockHeader(block: SyntaxNode, source: string): { type: string; labels: string[] } | null {

Callers 3

readBlockHeaderFunction · 0.85
emitModuleWiringFunction · 0.85
readStringAttrFunction · 0.85

Calls 1

getNodeTextFunction · 0.90

Tested by

no test coverage detected