lib: improve filterAttrs

Co-authored-by: Silvan Mosberger <contact@infinisil.com>
This commit is contained in:
h7x4 2024-09-30 18:05:30 +02:00
parent 73187eaa33
commit c7c30eb452
No known key found for this signature in database
GPG Key ID: 9F2F7D8250F35146

View File

@ -644,8 +644,7 @@ rec {
filterAttrs =
pred:
set:
listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
removeAttrs set (concatMap (name: if pred name set.${name} then [ ] else [ name ]) (attrNames set));
/**
Filter an attribute set recursively by removing all attributes for