我一直在网上搜刮如何从jsep解析的数据中构造出表达式。
考虑表达式
(designation=="MANAGER" || function=="SALES") && cohortid=="1"
这是JSEP解析器的输出
{ type: 'LogicalExpression',
operator: '&&',
left:
{ type: 'LogicalExpression',
operator: '||',
left:
{ type: 'BinaryExpression',
operator: '==',
left: [Object],
right: [Object] },
right:
{ type: 'BinaryExpression',
operator: '==',
left: [Object],
right: [Object] } },
right:
{ type: 'BinaryExpression',
operator: '==',
left: { type: 'Identifier', name: 'cohortid' },
right: { type: 'Literal', value: '1', raw: '"1"' } } }
现在我想要一些可以转换此/相似的库 输出回初始表达式。