From 4cf7ee965f97590e940d582fb3a43884d5db241d Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Thu, 19 Oct 2017 12:37:11 -0400 Subject: [PATCH] Rename regex* to regex-nav and move to specter.cljc. --- src/clj/com/rpl/specter.cljc | 9 ++++++++- src/clj/com/rpl/specter/navs.cljc | 6 ------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/clj/com/rpl/specter.cljc b/src/clj/com/rpl/specter.cljc index 0339c1f..5f6e6e4 100644 --- a/src/clj/com/rpl/specter.cljc +++ b/src/clj/com/rpl/specter.cljc @@ -1068,6 +1068,13 @@ (swap! structure next-fn) structure))) +(defnav regex-nav [re] + (select* [this structure next-fn] + (doseqres NONE [s (re-seq re structure)] + (next-fn s))) + (transform* [this structure next-fn] + (clojure.string/replace structure re next-fn))) + (defdynamicnav selected? "Filters the current value based on whether a path finds anything. e.g. (selected? :vals ALL even?) keeps the current element only if an @@ -1172,7 +1179,7 @@ (extend-type #?(:clj java.util.regex.Pattern :cljs js/RegExp) ImplicitNav - (implicit-nav [this] (n/regex* this))) + (implicit-nav [this] (regex-nav this))) (defnav ^{:doc "Navigates to the provided val if the structure is nil. Otherwise it stays diff --git a/src/clj/com/rpl/specter/navs.cljc b/src/clj/com/rpl/specter/navs.cljc index 5bbde51..b9a9552 100644 --- a/src/clj/com/rpl/specter/navs.cljc +++ b/src/clj/com/rpl/specter/navs.cljc @@ -478,12 +478,6 @@ structure (updater structure next-fn)))) -(defnav regex* [re] - (select* [this structure next-fn] - (doseqres i/NONE [s (re-seq re structure)] - (next-fn s))) - (transform* [this structure next-fn] - (clojure.string/replace structure re next-fn))) (defn- update-first-list [l afn] (let [newf (afn (first l))