🎉 Add many functions to assets panel and big refactor

This commit is contained in:
Andrés Moya 2021-05-12 14:00:30 +02:00
parent 3c7dda02c6
commit b2fef7b7a8
9 changed files with 906 additions and 446 deletions

View file

@ -479,8 +479,7 @@
:var [2 nil]}
:d [nil 10] }
If both maps are identical the result will be an empty map
"
If both maps are identical the result will be an empty map."
[m1 m2]
(let [m1ks (set (keys m1))

View file

@ -60,6 +60,8 @@
(d/export helpers/get-base-shape)
(d/export helpers/is-parent?)
(d/export helpers/get-index-in-parent)
(d/export helpers/split-path)
(d/export helpers/join-path)
(d/export helpers/parse-path-name)
(d/export helpers/merge-path-item)
(d/export helpers/compact-path)

View file

@ -408,11 +408,17 @@
(defn split-path
"Decompose a string in the form 'one / two / three' into
an array of strings, normalizing spaces."
a vector of strings, normalizing spaces."
[path]
(->> (str/split path "/")
(map str/trim)
(remove str/empty?)))
(remove str/empty?)
vec))
(defn join-path
"Regenerate a path as a string, from a vector."
[path-vec]
(str/join " / " path-vec))
(defn parse-path-name
"Parse a string in the form 'group / subgroup / name'.
@ -427,7 +433,9 @@
"Put the item at the end of the path."
[path name]
(if-not (empty? path)
(str path " / " name)
(if-not (empty? name)
(str path " / " name)
path)
name))
(defn compact-path