UNPKG

cream-and-sugar

Version:

A deliciously functional syntax for JavaScript with native support for JSX

22 lines (20 loc) 427 B
'use strict'; var _utils = require('../utils'); /* * Translate logic operators. */ (0, _utils.compile)(_utils.nodes.LogicNode, function () { var operatorMap = { and: '&&', or: '||', lt: '<', gt: '>', lte: '<=', gte: '>=', is: '===', isnt: '!==', "==": '===', "!=": '!==' }; return this.left.compile(true) + ' ' + operatorMap[this.operator] + ' ' + this.right.compile(true); });