@bonniernews/local-esi
Advanced tools
Comparing version 0.8.1 to 0.8.2
@@ -49,6 +49,31 @@ "use strict"; | ||
}, | ||
arguments: callExpressionMatch[2].split(",").map(esiExpressionParser) | ||
arguments: parseFunctionArgsFromString(callExpressionMatch[2]).map(esiExpressionParser)// callExpressionMatch[2].split(",").map(esiExpressionParser) | ||
}; | ||
} | ||
function parseFunctionArgsFromString(text) { | ||
const args = []; | ||
let current = ""; | ||
let insideString = false; | ||
for (let i = 0; i < text.length; i++) { | ||
const char = text[i]; | ||
if (char === "'") { | ||
insideString = !insideString; | ||
} | ||
if (char === "," && !insideString) { | ||
args.push(current); | ||
current = ""; | ||
continue; | ||
} | ||
current += char; | ||
if (i === text.length - 1) { | ||
args.push(current); | ||
} | ||
} | ||
return args; | ||
} | ||
const callExpressionWithoutArgsMatch = str.match(/^\$(\w+?)\(\)$/); | ||
@@ -55,0 +80,0 @@ if (callExpressionWithoutArgsMatch) { |
{ | ||
"name": "@bonniernews/local-esi", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"description": "Local Edge Side Includes parser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24822
720