lib: refactor lib.attrsets.{mapAttrs', mapAttrsToList} and mapAttrs'' in the strongswan-swanctl module (#403581)

This commit is contained in:
Johannes Kirschbauer 2025-05-08 09:42:40 +02:00 committed by GitHub
commit 5ee93d2532
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -1042,7 +1042,7 @@ rec {
:::
*/
mapAttrs' = f: set: listToAttrs (map (attr: f attr set.${attr}) (attrNames set));
mapAttrs' = f: set: listToAttrs (mapAttrsToList f set);
/**
Call a function for each attribute in the given set and return
@ -1076,7 +1076,7 @@ rec {
:::
*/
mapAttrsToList = f: attrs: map (name: f name attrs.${name}) (attrNames attrs);
mapAttrsToList = f: attrs: attrValues (mapAttrs f attrs);
/**
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).