Closed DevDimov closed 1 week ago
In Interface ExprNode, lhs can be both an ExprNode and ExprNode[]
ExprNode
lhs
ExprNode[]
For example, jsonata('($x := 1; $y := 2;)').ast().expressions outputs
jsonata('($x := 1; $y := 2;)').ast().expressions
[ { type: "bind", value: ":=", position: 7, lhs: { value: "x", type: "variable", position: 4 }, rhs: { value: 1, type: "number", position: 9 }, }, { type: "bind", value: ":=", position: 15, lhs: { value: "y", type: "variable", position: 13 }, rhs: { value: 2, type: "number", position: 16 }, }, ];
And jsonata('{"x": y, "z": 1}').ast() outputs
jsonata('{"x": y, "z": 1}').ast()
{ "type": "unary", "value": "{", "position": 1, "lhs": [ [ { "value": "x", "type": "string", "position": 4 }, { "type": "path", "steps": [ { "value": "y", "type": "name", "position": 7 } ] } ], [ { "value": "z", "type": "string", "position": 12 }, { "value": 1, "type": "number", "position": 15 } ] ] }
Similar issue: https://github.com/jsonata-js/jsonata/issues/585
I'm using node v20.13.0 and jsonata v2.0.4. Happy to open a pull request.
Fixed via PR (thank you!)
In Interface
ExprNode
,lhs
can be both anExprNode
andExprNode[]
For example,
jsonata('($x := 1; $y := 2;)').ast().expressions
outputsAnd
jsonata('{"x": y, "z": 1}').ast()
outputsSimilar issue: https://github.com/jsonata-js/jsonata/issues/585
I'm using node v20.13.0 and jsonata v2.0.4. Happy to open a pull request.