MCPcopy
hub / github.com/formatjs/formatjs / evaluatePath

Function evaluatePath

packages/babel-plugin-formatjs/utils.ts:24–33  ·  view source on GitHub ↗
(path: NodePath<any>)

Source from the content-addressed store, hash-verified

22])
23
24function evaluatePath(path: NodePath<any>): string {
25 const evaluated = path.evaluate()
26 if (evaluated.confident) {
27 return evaluated.value
28 }
29
30 throw path.buildCodeFrameError(
31 '[React Intl] Messages must be statically evaluate-able for extraction.'
32 )
33}
34
35export function getMessageDescriptorKey(path: NodePath<any>): string {
36 if (path.isIdentifier() || path.isJSXIdentifier()) {

Callers 2

getMessageDescriptorKeyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected