Rename regex* to regex-nav and move to specter.cljc.
This commit is contained in:
parent
f593753a68
commit
4cf7ee965f
2 changed files with 8 additions and 7 deletions
|
|
@ -1068,6 +1068,13 @@
|
||||||
(swap! structure next-fn)
|
(swap! structure next-fn)
|
||||||
structure)))
|
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?
|
(defdynamicnav selected?
|
||||||
"Filters the current value based on whether a path finds anything.
|
"Filters the current value based on whether a path finds anything.
|
||||||
e.g. (selected? :vals ALL even?) keeps the current element only if an
|
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)
|
(extend-type #?(:clj java.util.regex.Pattern :cljs js/RegExp)
|
||||||
ImplicitNav
|
ImplicitNav
|
||||||
(implicit-nav [this] (n/regex* this)))
|
(implicit-nav [this] (regex-nav this)))
|
||||||
|
|
||||||
(defnav
|
(defnav
|
||||||
^{:doc "Navigates to the provided val if the structure is nil. Otherwise it stays
|
^{:doc "Navigates to the provided val if the structure is nil. Otherwise it stays
|
||||||
|
|
|
||||||
|
|
@ -478,12 +478,6 @@
|
||||||
structure
|
structure
|
||||||
(updater structure next-fn))))
|
(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]
|
(defn- update-first-list [l afn]
|
||||||
(let [newf (afn (first l))
|
(let [newf (afn (first l))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue