sprig
sprig copied to clipboard
feature: Add functions safeDefault, safeCoalesce, and nonNil
Fixes #250
This adds functions similar to default
and coalesce
but only falls through for nil
values, and does not fall through 0
, false
or ""
.
Suggestions for better names are welcome. Have picked same names as in #250 .
~IMO safeEmpty
should just be ne nil
and is not needed.~
ne
actually fails when comparing nil
and something else. Added a function nonNil
for this.