Transforms undefined to undefinedValue, and applies otherTransform to all other values.
undefined
undefinedValue
otherTransform
import * as G from "flurp/guard";import * as L from "flurp/logic";const undefinedToEmpty = G.ifIsUndefined([], L.identity);undefinedToEmpty(undefined); // []undefinedToEmpty([3, 4, 5]); // [3, 4, 5]
Transforms
undefined
toundefinedValue
, and appliesotherTransform
to all other values.Example