diff --git a/lib/template.js b/lib/template.js index 265fd1e..6c62c73 100644 --- a/lib/template.js +++ b/lib/template.js @@ -94,9 +94,9 @@ const renderRecursively = (inputJson, template, execOptions = {}) => { return Object.fromEntries( Object.entries(template).flatMap(([key, value]) => { const SPREAD_KEYWORD = "spreadValue"; - const keywordMatcher = `^\\s*\\{\\{\\s*${SPREAD_KEYWORD}\\(\\s*\\)\\s*\\}\\}\\s*$`; // matches {{ () }} with white spaces where you'd expect them + const keywordMatcher = `^\\{\\{\\s*${SPREAD_KEYWORD}\\(\\s*\\)\\s*\\}\\}$`; // matches {{ () }} with white spaces where you'd expect them - if (key.match(keywordMatcher)) { + if (key.trim().match(keywordMatcher)) { const evaluatedValue = renderRecursively(inputJson, value, execOptions); if (typeof evaluatedValue !== "object") { throw new Error(