UNPKG

ut-tools

Version:

Build and Release management automation package.

3 lines (2 loc) 682 B
var e={name:"ternary",init(e){e.hooks.add("after-expression",(function(o){if(o.node&&this.code===e.QUMARK_CODE){this.index++;const t=o.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),o.node={type:"ConditionalExpression",test:t,consequent:r,alternate:i},t.operator&&e.binary_ops[t.operator]<=.9){let r=t;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;o.node.test=r.right,r.right=o.node,o.node=t}}else this.throwError("Expected :")}}))}};export{e as default}; //# sourceMappingURL=index.min.js.map