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

Function tryGetTextOfPropertyName

test/fixtures/snapshot/typescript.js:15224–15240  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

15222 }
15223 ts.isComputedNonLiteralName = isComputedNonLiteralName;
15224 function tryGetTextOfPropertyName(name) {
15225 switch (name.kind) {
15226 case 79 /* SyntaxKind.Identifier */:
15227 case 80 /* SyntaxKind.PrivateIdentifier */:
15228 return name.escapedText;
15229 case 10 /* SyntaxKind.StringLiteral */:
15230 case 8 /* SyntaxKind.NumericLiteral */:
15231 case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */:
15232 return ts.escapeLeadingUnderscores(name.text);
15233 case 162 /* SyntaxKind.ComputedPropertyName */:
15234 if (isStringOrNumericLiteralLike(name.expression))
15235 return ts.escapeLeadingUnderscores(name.expression.text);
15236 return undefined;
15237 default:
15238 return ts.Debug.assertNever(name);
15239 }
15240 }
15241 ts.tryGetTextOfPropertyName = tryGetTextOfPropertyName;
15242 function getTextOfPropertyName(name) {
15243 return ts.Debug.checkDefined(tryGetTextOfPropertyName(name));

Callers 2

getTextOfPropertyNameFunction · 0.85
getPropertyAssignmentFunction · 0.85

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…