lib: lists: add 'mapFilter'
This commit is contained in:
parent
3736e3a415
commit
7d2c43d157
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