Sha256: d9a0d318707895b198cbc0dab6c0fc9c06d19aacaa801aa7e7e00eb233c322a6
Contents?: true
Size: 962 Bytes
Versions: 3
Compression:
Stored size: 962 Bytes
Contents
(function (tree) { tree.Operation = function (op, operands) { this.op = op.trim(); this.operands = operands; }; tree.Operation.prototype.eval = function (env) { var a = this.operands[0].eval(env), b = this.operands[1].eval(env), temp; if (a instanceof tree.Dimension && b instanceof tree.Color) { if (this.op === '*' || this.op === '+') { temp = b, b = a, a = temp; } else { throw { name: "OperationError", message: "Can't substract or divide a color from a number" }; } } if (!a.operate) { throw { name: "OperationError", message: "Operation on an invalid type" }; } return a.operate(this.op, b); }; tree.operate = function (op, a, b) { switch (op) { case '+': return a + b; case '-': return a - b; case '*': return a * b; case '/': return a / b; } }; })(require('../tree'));
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
less-2.3.3 | lib/less/js/lib/less/tree/operation.js |
less-2.3.2 | lib/less/js/lib/less/tree/operation.js |
less-2.3.1 | lib/less/js/lib/less/tree/operation.js |