Skip to content

Commit 2ae6874

Browse files
committed
1.7.5
1 parent b307f6f commit 2ae6874

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

dist/liquid.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,7 @@ module.exports = factory;
888888
var _ = require('./util/underscore.js');
889889
var lexical = require('./lexical.js');
890890
var assert = require('./util/assert.js');
891+
var toStr = Object.prototype.toString;
891892

892893
var Scope = {
893894
getAll: function getAll() {
@@ -962,9 +963,16 @@ var Scope = {
962963
throw new TypeError('undefined variable');
963964
}
964965
var variable = obj[varName];
966+
var lastName = paths.pop();
965967
paths.forEach(function (p) {
966968
return variable = variable[p];
967969
});
970+
if (undefined !== lastName) {
971+
if (lastName === 'size' && (toStr.call(variable) === '[object Array]' || toStr.call(variable) === '[object String]')) {
972+
return variable.length;
973+
}
974+
variable = variable[lastName];
975+
}
968976
return variable;
969977
},
970978

0 commit comments

Comments
 (0)