Improve history handling on frontend.

This commit is contained in:
Andrey Antukh 2017-03-25 19:35:54 +01:00
parent 691c359985
commit 94677f2f7e
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
11 changed files with 322 additions and 281 deletions

View file

@ -57,13 +57,13 @@
coll)))
(defn replace-by-id
[coll value]
{:pre [(vector? coll)]}
(mapv (fn [item]
([value]
(map (fn [item]
(if (= (:id item) (:id value))
value
item)) coll))
item))))
([coll value]
(sequence (replace-by-id value) coll)))
(defn deep-merge
"Like merge, but merges maps recursively."
@ -80,6 +80,16 @@
(disj s v)
(conj s v)))
(defn seek
([pred coll]
(seek pred coll nil))
([pred coll not-found]
(reduce (fn [_ x]
(if (pred x)
(reduced x)
not-found))
not-found coll)))
;; --- String utils
(def +uuid-re+