···542 attrs:
543 map (name: f name attrs.${name}) (attrNames attrs);
544000000000000000000000000000000545546 /* Like `mapAttrs`, except that it recursively applies itself to
547 the *leaf* attributes of a potentially-nested attribute set:
···542 attrs:
543 map (name: f name attrs.${name}) (attrNames attrs);
544545+ /*
546+ Deconstruct an attrset to a list of name-value pairs as expected by [`builtins.listToAttrs`](https://nixos.org/manual/nix/stable/language/builtins.html#builtins-listToAttrs).
547+ Each element of the resulting list is an attribute set with these attributes:
548+ - `name` (string): The name of the attribute
549+ - `value` (any): The value of the attribute
550+551+ The following is always true:
552+ ```nix
553+ builtins.listToAttrs (attrsToList attrs) == attrs
554+ ```
555+556+ :::{.warning}
557+ The opposite is not always true. In general expect that
558+ ```nix
559+ attrsToList (builtins.listToAttrs list) != list
560+ ```
561+562+ This is because the `listToAttrs` removes duplicate names and doesn't preserve the order of the list.
563+ :::
564+565+ Example:
566+ attrsToList { foo = 1; bar = "asdf"; }
567+ => [ { name = "bar"; value = "asdf"; } { name = "foo"; value = 1; } ]
568+569+ Type:
570+ attrsToList :: AttrSet -> [ { name :: String; value :: Any; } ]
571+572+ */
573+ attrsToList = mapAttrsToList nameValuePair;
574+575576 /* Like `mapAttrs`, except that it recursively applies itself to
577 the *leaf* attributes of a potentially-nested attribute set: