mirror of
https://github.com/harttle/liquidjs.git
synced 2026-10-02 16:45:14 -07:00
1.7.6
This commit is contained in:
Vendored
+8
-8
@@ -662,16 +662,16 @@ var operators = {
|
|||||||
return l != r;
|
return l != r;
|
||||||
},
|
},
|
||||||
'>': function _(l, r) {
|
'>': function _(l, r) {
|
||||||
return l > r;
|
return l !== null && r !== null && l > r;
|
||||||
},
|
},
|
||||||
'<': function _(l, r) {
|
'<': function _(l, r) {
|
||||||
return l < r;
|
return l !== null && r !== null && l < r;
|
||||||
},
|
},
|
||||||
'>=': function _(l, r) {
|
'>=': function _(l, r) {
|
||||||
return l >= r;
|
return l !== null && r !== null && l >= r;
|
||||||
},
|
},
|
||||||
'<=': function _(l, r) {
|
'<=': function _(l, r) {
|
||||||
return l <= r;
|
return l !== null && r !== null && l <= r;
|
||||||
},
|
},
|
||||||
'contains': function contains(l, r) {
|
'contains': function contains(l, r) {
|
||||||
if (!l) return false;
|
if (!l) return false;
|
||||||
@@ -1116,12 +1116,11 @@ function evalValue(str, scope) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isTruthy(val) {
|
function isTruthy(val) {
|
||||||
if (val instanceof Array) return !!val.length;
|
return !isFalsy(val);
|
||||||
return !!val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function isFalsy(val) {
|
function isFalsy(val) {
|
||||||
return !isTruthy(val);
|
return false === val || undefined === val || null === val;;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -2086,7 +2085,8 @@ module.exports = function (liquid) {
|
|||||||
var _this2 = this;
|
var _this2 = this;
|
||||||
|
|
||||||
var collection = Liquid.evalExp(this.collection, scope);
|
var collection = Liquid.evalExp(this.collection, scope);
|
||||||
if (Liquid.isFalsy(collection)) {
|
|
||||||
|
if (!Array.isArray(collection) || Array.isArray(collection) && collection.length === 0) {
|
||||||
return liquid.renderer.renderTemplates(this.elseTemplates, scope);
|
return liquid.renderer.renderTemplates(this.elseTemplates, scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-3
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "shopify-liquid",
|
"name": "shopify-liquid",
|
||||||
"version": "1.7.5",
|
"version": "1.7.6",
|
||||||
"description": "A feature-rich Liquid template engine for Node.js and browsers, with compliance with the Ruby version.",
|
"description": "A feature-rich Liquid template engine for Node.js and browsers, with compliance with the Ruby version.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user