@bonniernews/local-esi
Advanced tools
Comparing version 0.7.5 to 0.8.0
@@ -31,2 +31,12 @@ "use strict"; | ||
const arithmeticMatch = str.match(/(.*?(?:\d|\)|'))\s*(\+|-|\*|\/|%)\s*((?:-|\(|\$|\d|').*)/); | ||
if (arithmeticMatch) { | ||
return { | ||
type: "BinaryExpression", | ||
operator: arithmeticMatch[2], | ||
left: esiExpressionParser(arithmeticMatch[1]), | ||
right: esiExpressionParser(arithmeticMatch[3]) | ||
}; | ||
} | ||
const callExpressionMatch = str.match(/^\$(\w+?)\((.+?)\)$/); | ||
@@ -33,0 +43,0 @@ if (callExpressionMatch) { |
@@ -58,2 +58,7 @@ "use strict"; | ||
if (node.operator === ">") return left > right; | ||
if (node.operator === "+") return left + right; | ||
if (node.operator === "-") return left - right; | ||
if (node.operator === "*") return left * right; | ||
if (node.operator === "/") return left / right; | ||
if (node.operator === "%") return left % right; | ||
if (node.operator === "has") return left.indexOf(right) > -1; | ||
@@ -60,0 +65,0 @@ if (node.operator === "has_i") return left.toLowerCase().indexOf(right.toLowerCase()) > -1; |
{ | ||
"name": "@bonniernews/local-esi", | ||
"version": "0.7.5", | ||
"version": "0.8.0", | ||
"description": "Local Edge Side Includes parser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
24088
679