MCPcopy
hub / github.com/formatjs/formatjs / literalToObj

Function literalToObj

packages/ts-transformer/transform.ts:91–104  ·  view source on GitHub ↗
(ts: TypeScript, n: typescript.Node)

Source from the content-addressed store, hash-verified

89}
90
91function literalToObj(ts: TypeScript, n: typescript.Node) {
92 if (ts.isNumericLiteral(n)) {
93 return +n.text
94 }
95 if (ts.isStringLiteral(n)) {
96 return n.text
97 }
98 if (n.kind === ts.SyntaxKind.TrueKeyword) {
99 return true
100 }
101 if (n.kind === ts.SyntaxKind.FalseKeyword) {
102 return false
103 }
104}
105
106function objectLiteralExpressionToObj(
107 ts: TypeScript,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected