mapAttrs
lib.mapAttrs
Primop
Docs pulled from | This Revision | 10 minutes ago
Takes 2 arguments
f, attrset
Apply a function to each element in an attribute set, creating a new attribute set.
Inputs
f
-
A function that takes an attribute name and its value, and returns the new value for the attribute.
attrset
-
The attribute set to iterate through.
Type
mapAttrs :: (String -> Any -> Any) -> AttrSet -> AttrSet
Examples
lib.attrsets.mapAttrs
usage example
mapAttrs (name: value: name + "-" + value)
{ x = "foo"; y = "bar"; }
=> { x = "x-foo"; y = "y-bar"; }
Noogle detected
Implementation
This function is implemented in c++ and is part of the native nix runtime.