mapNullable
lib.trivial.mapNullable
Docs pulled from | This Revision | 10 minutes ago
Apply function if the supplied argument is non-null.
Inputs
f
-
Function to call
a
-
Argument to check for null before passing it to
f
Examples
lib.trivial.mapNullable
usage example
mapNullable (x: x+1) null
=> null
mapNullable (x: x+1) 22
=> 23
Noogle detected
Implementation
The following is the current implementation of this function.
mapNullable = f: a: if a == null then a else f a;