ut-tools
Version:
Build and Release management automation package.
3 lines (2 loc) • 695 B
JavaScript
"use strict";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 s=this.gobbleExpression();if(s||this.throwError("Expected expression"),o.node={type:"ConditionalExpression",test:t,consequent:r,alternate:s},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 :")}}))}};module.exports=e;
//# sourceMappingURL=index.cjs.min.js.map