mirror of
https://github.com/penpot/penpot.git
synced 2025-06-09 13:51:38 +02:00
Add token value parsing function
This commit is contained in:
parent
980238e27b
commit
2e8e33d701
2 changed files with 27 additions and 8 deletions
|
@ -4,6 +4,14 @@
|
|||
[clojure.set :as set]
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
(def parseable-token-value-regexp
|
||||
#"^\s*(-?[0-9]+\.?[0-9]*)\s*$")
|
||||
|
||||
(defn parse-token-value [value]
|
||||
(when-let [double-str (-> (re-find parseable-token-value-regexp value)
|
||||
(last))]
|
||||
(d/parse-double double-str)))
|
||||
|
||||
(defn find-token-references
|
||||
"Finds token reference values in `value-string` and returns a set with all contained namespaces."
|
||||
[value-string]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue