Applies nullishTransform if the argument is nullish, i.e., null or undefined, and otherTransform if it is not.
nullishTransform
null
undefined
otherTransform
import * as G from "flurp/guard";import * as L from "flurp/logic";const nullishToEmpty = G.ifIsNullish([], L.identity);nullishToEmpty(null); // []nullishToEmpty(undefined); // []nullishToEmpty([3, 4, 5]); // [3, 4, 5]
Applies
nullishTransform
if the argument is nullish, i.e.,null
orundefined
, andotherTransform
if it is not.Example