length-zero-default: Default value for 'length(x) == 0'.

Description Usage Arguments Examples

Description

This infix function makes it easy to replace a length 0 value with a default value. It's inspired by the way that Ruby's or operation ('||') works.

Usage

1
x %|0|% y

Arguments

x, y

If 'length(x) == 0', will return 'y'; otherwise returns 'x'.

Examples

1
2
"bacon" %|0|% "eggs"
NULL %|0|% "eggs"

GarrettMooney/moonmisc documentation built on Oct. 19, 2019, 7:51 p.m.