lib: lists: add 'mapFilter'
This commit is contained in:
parent
11fbbd62eb
commit
4f742b69f2
13
lib/lists.nix
Normal file
13
lib/lists.nix
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib) filter;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# Filter a list using a predicate function after applying a map.
|
||||||
|
#
|
||||||
|
# mapFilter ::
|
||||||
|
# (value -> bool)
|
||||||
|
# (any -> value)
|
||||||
|
# [ any ]
|
||||||
|
mapFilter = pred: f: attrs: filter pred (map f attrs);
|
||||||
|
}
|
Loading…
Reference in a new issue