query
On this page

mapAttrsToList

lib.mapAttrsToList

Docs pulled from | This Revision | 13 minutes 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" ]
(lib.attrsets.mapAttrsToList)

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

mapAttrsToList =
    f:
    attrs:
    map (name: f name attrs.${name}) (attrNames attrs);