mirror of
https://github.com/penpot/penpot.git
synced 2025-01-07 15:39:42 -05:00
⚡ Optimize d/mapm helper using reduce-kv
This commit is contained in:
parent
893a8992c3
commit
733825edfa
1 changed files with 5 additions and 2 deletions
|
@ -316,9 +316,12 @@
|
|||
(defn mapm
|
||||
"Map over the values of a map"
|
||||
([mfn]
|
||||
(map (fn [[key val]] [key (mfn key val)])))
|
||||
(map (fn [[key val]] (vec2 key (mfn key val)))))
|
||||
([mfn coll]
|
||||
(into {} (mapm mfn) coll)))
|
||||
(reduce-kv (fn [coll k v]
|
||||
(assoc coll k (mfn k v)))
|
||||
coll
|
||||
coll)))
|
||||
|
||||
(defn removev
|
||||
"Returns a vector of the items in coll for which (fn item) returns logical false"
|
||||
|
|
Loading…
Reference in a new issue