diff options
author | John Ericson <Ericson2314@yahoo.com> | 2017-04-17 17:12:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-17 17:12:14 -0400 |
commit | 37e5e71fdf098a45471537e9961672592ef6f72a (patch) | |
tree | 43eb5da139409f5882c5b3194192a7088fba231f /lib | |
parent | 383706f36db17307b7c2650ad35773f6c5b410d1 (diff) | |
parent | 85aa5005af530fef199cc41148e374e54d70e01e (diff) |
Merge pull request #24974 from Ericson2314/mapNullable
Introduce `mapNullable` into lib and use it in a few places
Diffstat (limited to 'lib')
-rw-r--r-- | lib/trivial.nix | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix index 62906339e605..735aa55e0dce 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -122,6 +122,9 @@ rec { # Flip the order of the arguments of a binary function. flip = f: a: b: f b a; + # Apply function if argument is non-null + mapNullable = f: a: if isNull a then a else f a; + # Pull in some builtins not included elsewhere. inherit (builtins) pathExists readFile isBool isFunction |