Skip to content

Commit ba7f305

Browse files
committed
Refactor remove-surrounding-whitespace function
Consolidate the definition of remove-surrounding-whitespace to improve clarity and maintainability. The function now mantains contract since it is a public function.
1 parent 61773b4 commit ba7f305

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

cljfmt/src/cljfmt/core.cljc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@
7878
(not (comment? (z/right* zloc))))
7979
(nil? (z/skip z/right* clojure-whitespace? zloc)))))
8080

81-
(defn remove-surrounding-whitespace [form opts]
82-
(transform form edit-all #(surrounding-whitespace? % opts) z/remove*))
83-
8481
(defn- element? [zloc]
8582
(and zloc (not (z/whitespace-or-comment? zloc))))
8683

@@ -417,6 +414,12 @@
417414
(when (form-matches-key? zloc sym context)
418415
(list-indent zloc context))))
419416

417+
(defn remove-surrounding-whitespace
418+
([form]
419+
(remove-surrounding-whitespace form default-options))
420+
([form opts]
421+
(transform form edit-all #(surrounding-whitespace? % opts) z/remove*)))
422+
420423
(defn- make-indenter [[key opts] context]
421424
(apply some-fn (map (partial indenter-fn key context) opts)))
422425

0 commit comments

Comments
 (0)