This commit is contained in:
harttle
2018-07-16 15:04:40 +08:00
parent 02806b2257
commit 931550669c
3 changed files with 10 additions and 5 deletions
+8 -3
View File
@@ -965,12 +965,17 @@ var Scope = {
} }
var key = paths.shift(); var key = paths.shift();
var value = getValueFromScopes(key, scopes); var value = getValueFromScopes(key, scopes);
return paths.reduce(function (value, key) { if (_.isNil(value)) {
throw new TypeError('undefined variable: ' + key);
}
while (paths.length) {
key = paths.shift();
value = getValueFromParent(key, value);
if (_.isNil(value)) { if (_.isNil(value)) {
throw new TypeError('undefined variable: ' + key); throw new TypeError('undefined variable: ' + key);
} }
return getValueFromParent(key, value); }
}, value); return value;
}, },
/* /*
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "liquidjs", "name": "liquidjs",
"version": "5.0.0", "version": "5.0.1",
"description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.", "description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {