3
Truthy and Falsy
harttle edited this page 2019-08-06 00:51:59 +08:00

Though liquidjs is designed platform-independent, there're certain differences with the Ruby version, one of which is the truthy evaluation.

Everything other than false and nil is truthy in the ruby version, see: https://shopify.github.io/liquid/basics/truthy-and-falsy/

In this JavaScript version, things are slightly different:

value truthy falsy
true ✔️
false ✔️
null ✔️
undefined ✔️
string ✔️
empty string ✔️
0 ✔️
integer ✔️
float ✔️
array ✔️
empty array ✔️