Skip to content

Bars Specification 0.1.1 — Transform: default

Category: misc · Since: 0.1.0

Substitutes a fallback value for null, empty string, or empty list input.

Returns value when the input is null, an empty string, or an empty list, and passes the input through unchanged otherwise. Unlike Shopify Liquid, false and 0 are never replaced — kBars always behaves as if Liquid's allow_false were true.

Arguments

Name Type Optional Default
value any no

Arity: 1–1

Worked examples

{{ missing | default: "fallback" }}

fallback

▶ Try it in the playground

{{ x | default: "fallback" }}

hello

▶ Try it in the playground

Full fixture: transforms/transform-default.json