lib: lists: add 'nullableToList'
This commit is contained in:
parent
bd69e28143
commit
c01f657e8d
1 changed files with 6 additions and 0 deletions
|
@ -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 [ ];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue