Studying all day long)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.3 KiB

2 years ago
"use strict";
exports.__esModule = true;
function binaryOperation(operator, left, right) {
switch (operator) {
case '+':
return left + right;
case '-':
return left - right;
case '/':
return left / right;
case '%':
return left % right;
case '*':
return left * right;
case '**':
return Math.pow(left, right);
case '&':
return left & right;
case '|':
return left | right;
case '>>':
return left >> right;
case '>>>':
return left >>> right;
case '<<':
return left << right;
case '^':
return left ^ right;
case '==':
return left == right;
case '===':
return left === right;
case '!=':
return left != right;
case '!==':
return left !== right;
case 'in':
return left in right;
case 'instanceof':
return left instanceof right;
case '>':
return left > right;
case '<':
return left < right;
case '>=':
return left >= right;
case '<=':
return left <= right;
}
}
exports["default"] = binaryOperation;