This commit is contained in:
harttle
2017-03-20 15:07:10 +08:00
parent b307f6ffd0
commit 2ae6874397
3 changed files with 11 additions and 3 deletions
+8
View File
@@ -888,6 +888,7 @@ module.exports = factory;
var _ = require('./util/underscore.js');
var lexical = require('./lexical.js');
var assert = require('./util/assert.js');
var toStr = Object.prototype.toString;
var Scope = {
getAll: function getAll() {
@@ -962,9 +963,16 @@ var Scope = {
throw new TypeError('undefined variable');
}
var variable = obj[varName];
var lastName = paths.pop();
paths.forEach(function (p) {
return variable = variable[p];
});
if (undefined !== lastName) {
if (lastName === 'size' && (toStr.call(variable) === '[object Array]' || toStr.call(variable) === '[object String]')) {
return variable.length;
}
variable = variable[lastName];
}
return variable;
},
+2 -2
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "shopify-liquid",
"version": "1.7.4",
"version": "1.7.5",
"description": "A feature-rich Liquid template engine for Node.js and browsers, with compliance with the Ruby version.",
"main": "index.js",
"scripts": {