Comparison on NULL is always false (#27)

* All values in Liquid are truthy except nil and false.

* The falsy values are null, undefined and false.

* comparison on null
This commit is contained in:
chenos
2017-03-21 14:54:26 +08:00
committed by Jun Yang
parent 66774865f4
commit e72f295bd0
2 changed files with 53 additions and 4 deletions
+4 -4
View File
@@ -1,10 +1,10 @@
var operators = {
'==': (l, r) => l == r,
'!=': (l, r) => l != r,
'>': (l, r) => l > r,
'<': (l, r) => l < r,
'>=': (l, r) => l >= r,
'<=': (l, r) => l <= r,
'>': (l, r) => l !== null && r !== null && l > r,
'<': (l, r) => l !== null && r !== null && l < r,
'>=': (l, r) => l !== null && r !== null && l >= r,
'<=': (l, r) => l !== null && r !== null && l <= r,
'contains': (l, r) => {
if (!l) return false;
if (typeof l.indexOf !== 'function') return false;