0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-23 15:26:29 -05:00

Declare transducer statically for path split function

This commit is contained in:
Andrey Antukh 2025-02-06 13:25:31 +01:00
parent df6a679548
commit baa5258a43

View file

@ -26,13 +26,15 @@
(def valid-groupable-item? (def valid-groupable-item?
(sm/validator schema:groupable-item)) (sm/validator schema:groupable-item))
(def ^:private xf:clean-string
(comp (map str/trim)
(remove str/empty?)))
(defn split-path (defn split-path
"Decompose a string in the form 'one.two.three' into a vector of strings, removing spaces." "Decompose a string in the form 'one.two.three' into a vector of strings, removing spaces."
[path separator] [path separator]
(let [xf (comp (map str/trim) (->> (str/split path separator)
(remove str/empty?))] (into [] xf:clean-string)))
(->> (str/split path separator)
(into [] xf))))
(defn join-path (defn join-path
"Regenerate a path as a string, from a vector." "Regenerate a path as a string, from a vector."