UNPKG

jora

Version:

JavaScript object query engine

27 lines (24 loc) 510 B
'use strict'; function compile(node, ctx) { ctx.put('($=>('); ctx.createScope( () => ctx.node(node.right), (sp) => sp + ',' ); ctx.put('))'); ctx.put('('); ctx.nodeOrCurrent(node.left); ctx.put(')'); } function walk(node, ctx) { ctx.node(node.left); ctx.node(node.right); } function stringify(node, ctx) { ctx.node(node.left); ctx.put('|'); ctx.node(node.right); } exports.compile = compile; exports.stringify = stringify; exports.walk = walk;