Skip to content

Commit

Permalink
Fix issue with props containing numbers, two letter camel-case
Browse files Browse the repository at this point in the history
  • Loading branch information
lilactown committed Mar 8, 2019
1 parent 6d3b7cb commit 3afd7d4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Fixed

- Race condition in `<-deref` hook
- Props with numbers, two-letter camel-case were dropped or truncated


## [0.3.2] - Feb 25, 2019
Expand Down
24 changes: 23 additions & 1 deletion src/hx/utils.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,31 @@
(e.g. foo or foo-bar)."
[s]
(if (> (count s) 1)
(str/join "-" (map str/lower-case (re-seq #"\w[a-z/]+" s)))
(str/join "-" (map str/lower-case (re-seq #"\w[a-z0-9/]*" s)))
s))

(comment
(camel->kebab "x")

(camel->kebab "x1")

(camel->kebab "xx1")

(camel->kebab "xX")

(camel->kebab "xX1")

(camel->kebab "x1X")

(camel->kebab "xxX")

(camel->kebab "xXx")

(camel->kebab "xxXx")

(camel->kebab "x1xXx1")
)

(defn keyword->str [k]
(let [kw-ns (namespace k)
kw-name (name k)]
Expand Down

0 comments on commit 3afd7d4

Please sign in to comment.