filterAttrs
lib.attrsets.filterAttrs
Docs pulled from | This Revision | about 9 hours ago
Filter an attribute set by removing all attributes for which the given predicate return false.
Inputs
pred
-
Predicate taking an attribute name and an attribute value, which returns
true
to include the attribute, orfalse
to exclude the attribute. set
-
The attribute set to filter
Type
filterAttrs :: (String -> Any -> Bool) -> AttrSet -> AttrSet
Examples
lib.attrsets.filterAttrs
usage example
filterAttrs (n: v: n == "foo") { foo = 1; bar = 2; }
=> { foo = 1; }