UNPKG

@gent-js/gent

Version:

template-based data generator.

19 lines (18 loc) 530 B
import { toAstVisitor } from "./visitor.js"; export function parseCommand(input) { const commandExpressionFragment = toAstVisitor(input); let structuredCommandExpression; if (commandExpressionFragment !== undefined) { structuredCommandExpression = { expression: input, ...commandExpressionFragment, }; } else { structuredCommandExpression = { expression: input, name: "invalid", }; } return structuredCommandExpression; }