Skip to content

Commit

Permalink
first pass at fix to #320
Browse files Browse the repository at this point in the history
fixed whitespace
  • Loading branch information
tommy-mor committed Sep 13, 2024
1 parent 67e8680 commit 7a2fe14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/clj/com/rpl/specter/navs.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@
(comp (map next-fn)
(filter not-NONE?))
structure))

#?(:clj String :cljs string)
(all-transform [structure next-fn]
(apply str (into []
(comp (map next-fn)
(filter not-NONE?))
structure)))

#?(:clj clojure.lang.PersistentHashSet :cljs cljs.core/PersistentHashSet)
(all-transform [structure next-fn]
Expand Down
5 changes: 5 additions & 0 deletions test/com/rpl/specter/core_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,11 @@
(is (= "abq" (setval s/LAST "q" "abc")))
)

(deftest string-transform-test
(is (= "123" (transform s/ALL identity "123")))
(is (= "123" (setval [s/ALL #(Character/isWhitespace %)] s/NONE "1 2 3")))
(is (= "123" (transform [(s/filterer #(Character/isWhitespace %))] s/NONE "1 2 3"))))

(deftest regex-navigation-test
;; also test regexes as implicit navs
(is (= (select #"t" "test") ["t" "t"]))
Expand Down

0 comments on commit 7a2fe14

Please sign in to comment.