lib: lists: add 'nullableToList'

This commit is contained in:
Bruno BELANYI 2023-10-26 19:36:32 +01:00
parent bd69e28143
commit c01f657e8d

View file

@ -24,4 +24,10 @@ in
# (any -> value)
# [ any ]
mapFilter = pred: f: attrs: filter pred (map f attrs);
# Transform a nullable value into a list of zero/one element.
#
# nullableToList ::
# (nullable a) -> [ a ]
nullableToList = x: if x != null then [ x ] else [ ];
}