attrsToList
lib.attrsets.attrsToList
Docs pulled from | This Revision | 4 days ago
Deconstruct an attrset to a list of name-value pairs as expected by builtins.listToAttrs.
Each element of the resulting list is an attribute set with these attributes:
name(string): The name of the attributevalue(any): The value of the attribute
The following is always true:
builtins.listToAttrs (attrsToList attrs) == attrs
The opposite is not always true. In general expect that
attrsToList (builtins.listToAttrs list) != list
This is because the listToAttrs removes duplicate names and doesn't preserve the order of the list.
Inputs
set-
The attribute set to deconstruct.
Type
attrsToList :: AttrSet -> [ { name :: String; value :: Any; } ]
Examples
lib.attrsets.attrsToList usage example
attrsToList { foo = 1; bar = "asdf"; }
=> [ { name = "bar"; value = "asdf"; } { name = "foo"; value = 1; } ]
Noogle detected
Implementation
The following is the current implementation of this function.
attrsToList = mapAttrsToList nameValuePair;