diff --git a/lib/conditionHandler.js b/lib/conditionHandler.js index 27a31f1..d0d6003 100644 --- a/lib/conditionHandler.js +++ b/lib/conditionHandler.js @@ -28,6 +28,13 @@ var ConditionHandler; return this.evaluateExpression(parent, mexp.property); case 'Literal': return exp.value; + //added Logical Expression + case 'LogicalExpression': + var lexp = exp; + var value1 = this.evaluateExpression(object, lexp.left); + var value2 = this.evaluateExpression(object, lexp.right); + var b = this.calculateExpression(lexp.operator, value1, value2); + return b; default: throw new Error('condition type ' + exp.type + ' is not recognized'); } @@ -66,6 +73,11 @@ var ConditionHandler; return value1 / value2; case '%': return value1 % value2; + //added logical operators + case '&&': + return value1 && value2; + case '||': + return value1 || value2; default: break; }