MCPcopy Create free account
hub / github.com/observablehq/framework / getStringLiteralValue

Function getStringLiteralValue

src/javascript/source.ts:25–31  ·  view source on GitHub ↗
(node: StringLiteral)

Source from the content-addressed store, hash-verified

23}
24
25export function getStringLiteralValue(node: StringLiteral): string {
26 return node.type === "TemplateLiteral"
27 ? getTemplateLiteralValue(node)
28 : node.type === "BinaryExpression"
29 ? getBinaryExpressionValue(node)
30 : node.value; // Literal or ParamReference
31}
32
33function getTemplateLiteralValue(node: TemplateLiteral): string {
34 let value = node.quasis[0].value.cooked!;

Callers 13

maybeStringLiteralValueFunction · 0.85
rewriteImportSourceFunction · 0.85
findImportSourceFunction · 0.85
transformFunction · 0.85
rewriteImportSourceFunction · 0.85
transpileModuleFunction · 0.85
CallExpressionFunction · 0.85
getTemplateLiteralValueFunction · 0.85
getBinaryExpressionValueFunction · 0.85
CallExpressionFunction · 0.85
findImportFunction · 0.85

Calls 2

getTemplateLiteralValueFunction · 0.85
getBinaryExpressionValueFunction · 0.85

Tested by

no test coverage detected