MCPcopy Create free account
hub / github.com/nodejs/node / buildLinkParts

Function buildLinkParts

test/fixtures/snapshot/typescript.js:128558–128586  ·  view source on GitHub ↗
(link, checker)

Source from the content-addressed store, hash-verified

128556 }
128557 ts.linkPart = linkPart;
128558 function buildLinkParts(link, checker) {
128559 var _a;
128560 var prefix = ts.isJSDocLink(link) ? "link"
128561 : ts.isJSDocLinkCode(link) ? "linkcode"
128562 : "linkplain";
128563 var parts = [linkPart("{@".concat(prefix, " "))];
128564 if (!link.name) {
128565 if (link.text) {
128566 parts.push(linkTextPart(link.text));
128567 }
128568 }
128569 else {
128570 var symbol = checker === null || checker === void 0 ? void 0 : checker.getSymbolAtLocation(link.name);
128571 var suffix = findLinkNameEnd(link.text);
128572 var name = ts.getTextOfNode(link.name) + link.text.slice(0, suffix);
128573 var text = skipSeparatorFromLinkText(link.text.slice(suffix));
128574 var decl = (symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) || ((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]);
128575 if (decl) {
128576 parts.push(linkNamePart(name, decl));
128577 if (text)
128578 parts.push(linkTextPart(text));
128579 }
128580 else {
128581 parts.push(linkTextPart(name + (suffix || text.indexOf("://") === 0 ? "" : " ") + text));
128582 }
128583 }
128584 parts.push(linkPart("}"));
128585 return parts;
128586 }
128587 ts.buildLinkParts = buildLinkParts;
128588 function skipSeparatorFromLinkText(text) {
128589 var pos = 0;

Callers

nothing calls this directly

Calls 9

linkPartFunction · 0.85
linkTextPartFunction · 0.85
findLinkNameEndFunction · 0.85
linkNamePartFunction · 0.85
concatMethod · 0.80
sliceMethod · 0.65
pushMethod · 0.45
indexOfMethod · 0.45

Tested by

no test coverage detected