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

Function getTextOfNodeFromSourceText

test/fixtures/snapshot/typescript.js:14769–14780  ·  view source on GitHub ↗
(sourceText, node, includeTrivia)

Source from the content-addressed store, hash-verified

14767 }
14768 ts.isExportNamespaceAsDefaultDeclaration = isExportNamespaceAsDefaultDeclaration;
14769 function getTextOfNodeFromSourceText(sourceText, node, includeTrivia) {
14770 if (includeTrivia === void 0) { includeTrivia = false; }
14771 if (nodeIsMissing(node)) {
14772 return "";
14773 }
14774 var text = sourceText.substring(includeTrivia ? node.pos : ts.skipTrivia(sourceText, node.pos), node.end);
14775 if (isJSDocTypeExpressionOrChild(node)) {
14776 // strip space + asterisk at line start
14777 text = text.split(/\r\n|\n|\r/).map(function (line) { return ts.trimStringStart(line.replace(/^\s*\*/, "")); }).join("\n");
14778 }
14779 return text;
14780 }
14781 ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText;
14782 function getTextOfNode(node, includeTrivia) {
14783 if (includeTrivia === void 0) { includeTrivia = false; }

Callers 1

Calls 5

nodeIsMissingFunction · 0.85
mapMethod · 0.65
joinMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…