guix_mirror_bot pushed a commit to branch javascript-team
in repository guix.

commit a611223a84ade68677eaa8f9a0f1f668aad558d3
Author: Nicolas Graves <[email protected]>
AuthorDate: Thu Sep 11 00:39:12 2025 +0200

    build-system: node: Refresh delete-dependencies procedure.
    
    * guix/build/node-build-system.scm (delete-dependencies): Use map and
    match-lambda to improve readability of the phase.
    
    Change-Id: I6d9275c7eea1514f103988215916d478a68ea466
    Signed-off-by: Jelle Licht <[email protected]>
---
 guix/build/node-build-system.scm | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index b52fbe847a..0cd05fc0e8 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -92,23 +92,19 @@ listed in 'dependencies-to-remove', a list of strings 
naming npm packages.
 
 To prevent the deleted dependencies from being reintroduced, use this function
 only after the 'patch-dependencies' phase."
-  (lambda (pkg-meta)
-    (fold
-      (lambda (dependency-key pkg-meta)
-        (alist-update
-          pkg-meta
-          dependency-key
-          (lambda (dependencies)
-            (remove
-              (lambda (dependency)
-                (member (car dependency) dependencies-to-remove))
-              dependencies))))
-      pkg-meta
-      (list
-        "devDependencies"
-        "dependencies"
-        "peerDependencies"
-        "optionalDependencies"))))
+  (let ((predicate (lambda (dependency)
+                     (member (car dependency) dependencies-to-remove)))
+        (dependency? (cut member <> (list "devDependencies"
+                                          "dependencies"
+                                          "peerDependencies"
+                                          "optionalDependencies"))))
+    (lambda (pkg-meta)
+      (map (match-lambda
+             (((? dependency? key) . dependencies)
+              (cons key (remove predicate dependencies)))
+             (otherwise
+              otherwise))
+           pkg-meta))))
 
 (define* (modify-json-fields
     fields

Reply via email to