Fix #96
This commit is contained in:
parent
86f05b3cbe
commit
a4857a9d57
2 changed files with 18 additions and 1 deletions
|
|
@ -607,6 +607,15 @@
|
||||||
))
|
))
|
||||||
|
|
||||||
(extend-protocol AllTransformProtocol
|
(extend-protocol AllTransformProtocol
|
||||||
|
;; in cljs they're PersistentVector so don't need a special case
|
||||||
|
#+clj clojure.lang.MapEntry
|
||||||
|
#+clj
|
||||||
|
(all-transform [structure next-fn]
|
||||||
|
(let [newk (next-fn (key structure))
|
||||||
|
newv (next-fn (val structure))]
|
||||||
|
(clojure.lang.MapEntry. newk newv)
|
||||||
|
))
|
||||||
|
|
||||||
#+clj clojure.lang.PersistentVector #+cljs cljs.core/PersistentVector
|
#+clj clojure.lang.PersistentVector #+cljs cljs.core/PersistentVector
|
||||||
(all-transform [structure next-fn]
|
(all-transform [structure next-fn]
|
||||||
(mapv next-fn structure))
|
(mapv next-fn structure))
|
||||||
|
|
|
||||||
|
|
@ -1017,3 +1017,11 @@
|
||||||
(is (= false (transform (s/nil->val true) identity false)))
|
(is (= false (transform (s/nil->val true) identity false)))
|
||||||
(is (= false (select-one! (s/nil->val true) false)))
|
(is (= false (select-one! (s/nil->val true) false)))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#+clj
|
||||||
|
(deftest all-map-entry
|
||||||
|
(let [e (transform s/ALL inc (first {1 3}))]
|
||||||
|
(is (instance? clojure.lang.MapEntry e))
|
||||||
|
(is (= 2 (key e)))
|
||||||
|
(is (= 4 (val e)))
|
||||||
|
))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue