Skip to content

Commit

Permalink
Fix errors in js_if check with array and obj
Browse files Browse the repository at this point in the history
Ref #61
  • Loading branch information
nolimits4web committed Jun 14, 2019
1 parent 142819c commit 9a02d73
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/utils.js
Expand Up @@ -215,14 +215,19 @@ const Template7Utils = {
else variable = undefined;
});
}
if (typeof variable === 'string') {
if (
(typeof variable === 'string')
|| Array.isArray(variable)
|| (variable.constructor && variable.constructor === Object)
) {
variable = JSON.stringify(variable);
}
if (variable === undefined) variable = 'undefined';

arr.push(variable);
return arr;
}, []).join('');

},
parseJsParents(expression, parents) {
return expression.split(/([+ \-*^()&=|<>!%:?])/g).reduce((arr, part) => {
Expand Down

0 comments on commit 9a02d73

Please sign in to comment.