mapAttrsToList
lib.mapAttrsToList
Docs pulled from | This Revision | about 1 hour ago
Call a function for each attribute in the given set and return the result in a list.
Inputs
f
-
A function, given an attribute's name and value, returns a new value.
attrs
-
Attribute set to map over.
Type
mapAttrsToList :: (String -> a -> b) -> AttrSet -> [b]
Examples
lib.attrsets.mapAttrsToList
usage example
mapAttrsToList (name: value: name + value)
{ x = "a"; y = "b"; }
=> [ "xa" "yb" ]
Noogle detected
Implementation
The following is the current implementation of this function.
mapAttrsToList =
f:
attrs:
map (name: f name attrs.${name}) (attrNames attrs);