Implement #165
This commit is contained in:
parent
1346cbc222
commit
9505ac6dd1
3 changed files with 5 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
## 0.13.3-SNAPSHOT
|
||||
|
||||
* Transform to `com.rpl.specter/NONE` to remove elements from data structures. Works with `keypath` (on maps only), `must` (on maps only), `ALL`, and `MAP-VALS`
|
||||
* Transform to `com.rpl.specter/NONE` to remove elements from data structures. Works with `keypath` (for both sequences and maps), `must`, `ALL`, and `MAP-VALS`
|
||||
* Dynamic navs automatically compile sequence returns if completely static
|
||||
|
||||
## 0.13.2
|
||||
|
|
|
|||
|
|
@ -466,10 +466,11 @@
|
|||
|
||||
|
||||
(defn- do-keypath-transform [vals structure key next-fn]
|
||||
;;TODO: not right, this doesn't handle sequences
|
||||
(let [newv (next-fn vals (get structure key))]
|
||||
(if (identical? newv i/NONE)
|
||||
(dissoc structure key)
|
||||
(if (sequential? structure)
|
||||
(i/srange-transform* structure key (inc key) (fn [_] []))
|
||||
(dissoc structure key))
|
||||
(assoc structure key newv))))
|
||||
|
||||
(defrichnav
|
||||
|
|
|
|||
|
|
@ -1327,6 +1327,7 @@
|
|||
(is (predand= list? '(1 2 3) (setval [s/ALL nil?] s/NONE '(1 2 nil 3 nil))))
|
||||
(is (= {:b 2} (setval :a s/NONE {:a 1 :b 2})))
|
||||
(is (= {:b 2} (setval (s/must :a) s/NONE {:a 1 :b 2})))
|
||||
(is (predand= vector? [1 3] (setval (s/keypath 1) s/NONE [1 2 3])))
|
||||
;; test with PersistentArrayMap
|
||||
(is (= {:a 1 :c 3} (setval [s/MAP-VALS even?] s/NONE {:a 1 :b 2 :c 3 :d 4})))
|
||||
(is (= {:a 1 :c 3} (setval [s/ALL (s/selected? s/LAST even?)] s/NONE {:a 1 :b 2 :c 3 :d 4})))
|
||||
|
|
|
|||
Loading…
Reference in a new issue