[][src]Function sprig::defaults::default

pub fn default(args: &[Value]) -> Result<Value, String>

Give a default value. Used like this: trim " "| default "empty". Since trim produces an empty string, the default value is returned. For things with a length (strings, slices, maps), len(0) will trigger the default. For numbers, the value 0 will trigger the default. For booleans, false will trigger the default. For structs, the default is never returned (there is no clear empty condition). For everything else, nil value triggers a default.