MCPcopy Create free account
hub / github.com/observablehq/framework / maybeParseExpression

Function maybeParseExpression

src/javascript/parse.ts:78–87  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

76 * additional input follows the expression.
77 */
78export function maybeParseExpression(input: string): Expression | null {
79 const parser = new (Parser as any)(acornOptions, input, 0); // private constructor
80 parser.nextToken();
81 try {
82 const node = parser.parseExpression();
83 return parser.type === tokTypes.eof ? node : null;
84 } catch {
85 return null;
86 }
87}

Callers 1

parseJavaScriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected