MCPcopy Index your code
hub / github.com/nodejs/node / getLiteralTextOfNode

Function getLiteralTextOfNode

test/fixtures/snapshot/typescript.js:114316–114334  ·  view source on GitHub ↗
(node, neverAsciiEscape, jsxAttributeEscape)

Source from the content-addressed store, hash-verified

114314 return ts.getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia);
114315 }
114316 function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
114317 if (node.kind === 10 /* SyntaxKind.StringLiteral */ && node.textSourceNode) {
114318 var textSourceNode = node.textSourceNode;
114319 if (ts.isIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) {
114320 var text = ts.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode);
114321 return jsxAttributeEscape ? "\"".concat(ts.escapeJsxAttributeString(text), "\"") :
114322 neverAsciiEscape || (ts.getEmitFlags(node) & 16777216 /* EmitFlags.NoAsciiEscaping */) ? "\"".concat(ts.escapeString(text), "\"") :
114323 "\"".concat(ts.escapeNonAsciiString(text), "\"");
114324 }
114325 else {
114326 return getLiteralTextOfNode(textSourceNode, neverAsciiEscape, jsxAttributeEscape);
114327 }
114328 }
114329 var flags = (neverAsciiEscape ? 1 /* GetLiteralTextFlags.NeverAsciiEscape */ : 0)
114330 | (jsxAttributeEscape ? 2 /* GetLiteralTextFlags.JsxAttributeEscape */ : 0)
114331 | (printerOptions.terminateUnterminatedLiterals ? 4 /* GetLiteralTextFlags.TerminateUnterminatedLiterals */ : 0)
114332 | (printerOptions.target && printerOptions.target === 99 /* ScriptTarget.ESNext */ ? 8 /* GetLiteralTextFlags.AllowNumericSeparator */ : 0);
114333 return ts.getLiteralText(node, currentSourceFile, flags);
114334 }
114335 /**
114336 * Push a new name generation scope.
114337 */

Callers 2

emitLiteralFunction · 0.85

Calls 2

getTextOfNodeFunction · 0.85
concatMethod · 0.80

Tested by

no test coverage detected