lib: lists: add 'mapFilter'

This commit is contained in:
Bruno BELANYI 2021-08-24 22:25:12 +02:00
parent 3736e3a415
commit 7d2c43d157
1 changed files with 13 additions and 0 deletions

13
lib/lists.nix Normal file
View 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);
}