mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
Add helper to remove attributes from applied-tokens
This commit is contained in:
@@ -8,6 +8,16 @@
|
||||
(->> (map (fn [attr] {attr id}) attributes)
|
||||
(into {})))
|
||||
|
||||
(defn remove-attributes-for-token-id
|
||||
"Removes applied tokens with `token-id` for the given `attributes` set from `applied-tokens`."
|
||||
[attributes token-id applied-tokens]
|
||||
(let [attr? (set attributes)]
|
||||
(->> (remove (fn [[k v]]
|
||||
(and (attr? k)
|
||||
(= v token-id)))
|
||||
applied-tokens)
|
||||
(into {}))))
|
||||
|
||||
(defn token-applied?
|
||||
"Test if `token` is applied to a `shape` with the given `token-attributes`."
|
||||
[token shape token-attributes]
|
||||
|
||||
Reference in New Issue
Block a user