mirror of
https://github.com/penpot/penpot.git
synced 2025-07-05 11:37:15 +02:00
Add dissoc-in helper into uxbox.util.data
This commit is contained in:
parent
283c3277fa
commit
68d75aacc9
1 changed files with 11 additions and 0 deletions
|
@ -37,6 +37,17 @@
|
||||||
(persistent!
|
(persistent!
|
||||||
(reduce #(dissoc! %1 %2) (transient data) keys)))
|
(reduce #(dissoc! %1 %2) (transient data) keys)))
|
||||||
|
|
||||||
|
(defn dissoc-in
|
||||||
|
[m [k & ks :as keys]]
|
||||||
|
(if ks
|
||||||
|
(if-let [nextmap (get m k)]
|
||||||
|
(let [newmap (dissoc-in nextmap ks)]
|
||||||
|
(if (seq newmap)
|
||||||
|
(assoc m k newmap)
|
||||||
|
(dissoc m k)))
|
||||||
|
m)
|
||||||
|
(dissoc m k)))
|
||||||
|
|
||||||
(defn index-of
|
(defn index-of
|
||||||
"Return the first index when appears the `v` value
|
"Return the first index when appears the `v` value
|
||||||
in the `coll` collection."
|
in the `coll` collection."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue