mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 12:20:40 -07:00
* docs: polish theme, playground, and reference pages Improve readability of the docs site with updated light/dark tokens, shared code-block styling, and playground editors that follow system color scheme. Skip CookieHub on localhost, serve the browser bundle from theme source, and use backtick titles on filter/tag reference pages for consistent navigation. Co-authored-by: Cursor <[email protected]> * docs: highlight npx in bash blocks and polish English copy Use Prism insertBefore for CLI commands like npx, tighten tutorial and reference wording, and keep YAML titles free of backticks so sidebar and page headings stay correct. Co-authored-by: Cursor <[email protected]> * docs: restore lowercase filter and tag titles Titles should match actual filter/tag identifiers (e.g. abs, append), not capitalized English labels. Co-authored-by: Cursor <[email protected]> --------- Co-authored-by: Cursor <[email protected]>
1.7 KiB
1.7 KiB
title
| title |
|---|
| Truthy and Falsy |
Though Liquid is platform-independent, there are certain differences with the Ruby version, one of which is the truthy value.
The Truth Table
According to Shopify document everything other than false and nil is truthy. But in JavaScript we have a totally different type system, we have types like undefined and we don't differentiate integer and float, thus things are slightly different:
| value | truthy | falsy |
|---|---|---|
true |
✔️ | |
false |
✔️ | |
null |
✔️ | |
undefined |
✔️ | |
string |
✔️ | |
empty string |
✔️ | |
0 |
✔️ | |
integer |
✔️ | |
float |
✔️ | |
array |
✔️ | |
empty array |
✔️ |
Use JavaScript Truthy
Note that LiquidJS uses Shopify's truthiness by default. It can be toggled to use standard JavaScript truthiness by setting the jsTruthy option to true.
| value | truthy | falsy |
|---|---|---|
true |
✔️ | |
false |
✔️ | |
null |
✔️ | |
undefined |
✔️ | |
string |
✔️ | |
empty string |
✔️ | |
0 |
✔️ | |
integer |
✔️ | |
float |
✔️ | |
array |
✔️ | |
empty array |
✔️ |