Skip to content

Commit

Permalink
use native dash->camel regex; bump 0.13.11
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Jun 13, 2021
1 parent 26a04b2 commit 9fe10f4
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 211 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Respo: A virtual DOM library in ClojureScript
[![Respo](https://img.shields.io/clojars/v/respo/respo.svg)](https://clojars.org/respo/respo)

```clojure
[respo "0.13.10"]
[respo "0.13.11"]
```

* Home http://respo-mvc.org
Expand Down
102 changes: 28 additions & 74 deletions calcit.cirru
Original file line number Diff line number Diff line change
Expand Up @@ -1106,88 +1106,42 @@
|r $ {} (:type :leaf) (:text |3) (:by |root) (:at 1504774121421)
|dashed->camel $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |defn$) (:by |rJoDgvdeG) (:at 1513612030324)
|T $ {} (:type :leaf) (:text |defn) (:by |rJoDgvdeG) (:at 1623597065142)
|j $ {} (:type :leaf) (:text |dashed->camel) (:by |root) (:at 1504774121421)
|r $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |x) (:by |root) (:at 1504774121421)
|j $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |dashed->camel) (:by |root) (:at 1504774121421)
|j $ {} (:type :leaf) (:text ||) (:by |root) (:at 1504774121421)
|r $ {} (:type :leaf) (:text |x) (:by |root) (:at 1504774121421)
|v $ {} (:type :leaf) (:text |false) (:by |root) (:at 1504774121421)
|v $ {} (:type :expr) (:by nil) (:at 1504774121421)
|T $ {} (:type :leaf) (:text |x) (:by |root) (:at 1504774121421)
|v $ {} (:type :expr) (:by |rJoDgvdeG) (:at 1623596977643)
:data $ {}
|T $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |acc) (:by |root) (:at 1504774121421)
|j $ {} (:type :leaf) (:text |piece) (:by |root) (:at 1504774121421)
|r $ {} (:type :leaf) (:text |promoted?) (:by |root) (:at 1504774121421)
|j $ {} (:type :expr) (:by nil) (:at 1504774121421)
|T $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623596980009) (:text |.replace)
|j $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597032220) (:text |dashed-letter-pattern)
|b $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597034900) (:text |x)
|r $ {} (:type :expr) (:by |rJoDgvdeG) (:at 1623597040209)
:data $ {}
|T $ {} (:type :leaf) (:text |if) (:by |root) (:at 1504774121421)
|j $ {} (:type :expr) (:by nil) (:at 1504774121421)
|T $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597040731) (:text |fn)
|j $ {} (:type :expr) (:by |rJoDgvdeG) (:at 1623597041880)
:data $ {}
|T $ {} (:type :leaf) (:text |=) (:by |root) (:at 1504774121421)
|j $ {} (:type :leaf) (:text |piece) (:by |root) (:at 1504774121421)
|r $ {} (:type :leaf) (:text ||) (:by |root) (:at 1504774121421)
|r $ {} (:type :leaf) (:text |acc) (:by |root) (:at 1504774121421)
|v $ {} (:type :expr) (:by nil) (:at 1504774121421)
|T $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597042320) (:text |cc)
|j $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597044071) (:text |pos)
|r $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597044977) (:text |prop)
|r $ {} (:type :expr) (:by |rJoDgvdeG) (:at 1623597047874)
:data $ {}
|T $ {} (:type :leaf) (:text |let) (:by |root) (:at 1504774121421)
|j $ {} (:type :expr) (:by nil) (:at 1504774121421)
|T $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597051832) (:text |.toUpperCase)
|j $ {} (:type :expr) (:by |rJoDgvdeG) (:at 1623597052494)
:data $ {}
|T $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |cursor) (:by |root) (:at 1504774121421)
|j $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |get) (:by |root) (:at 1504774121421)
|j $ {} (:type :leaf) (:text |piece) (:by |root) (:at 1504774121421)
|r $ {} (:type :leaf) (:text |0) (:by |root) (:at 1504774121421)
|j $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |piece-followed) (:by |root) (:at 1504774121421)
|j $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |subs) (:by |root) (:at 1504774121421)
|j $ {} (:type :leaf) (:text |piece) (:by |root) (:at 1504774121421)
|r $ {} (:type :leaf) (:text |1) (:by |root) (:at 1504774121421)
|r $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |if) (:by |root) (:at 1504774121421)
|j $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |=) (:by |root) (:at 1504774121421)
|j $ {} (:type :leaf) (:text |cursor) (:by |root) (:at 1504774121421)
|r $ {} (:type :leaf) (:text ||-) (:by |root) (:at 1504774121421)
|r $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |recur) (:by |root) (:at 1504774121421)
|j $ {} (:type :leaf) (:text |acc) (:by |root) (:at 1504774121421)
|r $ {} (:type :leaf) (:text |piece-followed) (:by |root) (:at 1504774121421)
|v $ {} (:type :leaf) (:text |true) (:by |root) (:at 1504774121421)
|v $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |recur) (:by |root) (:at 1504774121421)
|j $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |str) (:by |root) (:at 1504774121421)
|j $ {} (:type :leaf) (:text |acc) (:by |root) (:at 1504774121421)
|r $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |if) (:by |root) (:at 1504774121421)
|j $ {} (:type :leaf) (:text |promoted?) (:by |root) (:at 1504774121421)
|r $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |string/upper-case) (:by |root) (:at 1504774121421)
|j $ {} (:type :leaf) (:text |cursor) (:by |root) (:at 1504774121421)
|v $ {} (:type :leaf) (:text |cursor) (:by |root) (:at 1504774121421)
|r $ {} (:type :leaf) (:text |piece-followed) (:by |root) (:at 1504774121421)
|v $ {} (:type :leaf) (:text |false) (:by |root) (:at 1504774121421)
|T $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597053587) (:text |aget)
|j $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597054125) (:text |cc)
|r $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597054495) (:text |1)
|dashed-letter-pattern $ {} (:type :expr) (:by |rJoDgvdeG) (:at 1623597175922)
:data $ {}
|T $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597175922) (:text |def)
|j $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597175922) (:text |dashed-letter-pattern)
|r $ {} (:type :expr) (:by |rJoDgvdeG) (:at 1623597175922)
:data $ {}
|T $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597178129) (:text |new)
|j $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597182109) (:text |js/RegExp)
|r $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597183862) (:text "|\"g")
|n $ {} (:type :leaf) (:by |rJoDgvdeG) (:at 1623597191801) (:text "|\"-[a-z]")
|purify-events $ {} (:type :expr) (:by nil) (:at 1504774121421)
:data $ {}
|T $ {} (:type :leaf) (:text |defn) (:by |root) (:at 1504774121421)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "respo",
"version": "0.13.10",
"version": "0.13.11",
"description": "Virtual DOM library",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -29,7 +29,7 @@
"homepage": "https://github.com/Respo/respo#readme",
"dependencies": {},
"devDependencies": {
"shadow-cljs": "^2.11.18",
"shadow-cljs": "^2.14.5",
"source-map-support": "^0.5.19",
"ws": "^7.4.6"
}
Expand Down
2 changes: 1 addition & 1 deletion release.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{:version "0.13.10",
{:version "0.13.11",
:group-id "respo",
:artifact-id "respo",
:skip-tag true,
Expand Down
16 changes: 4 additions & 12 deletions src/respo/util/format.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@
(ns respo.util.format
(:require [clojure.string :as string] [respo.util.detect :refer [component? element?]]))

(defn dashed->camel
([x] (dashed->camel "" x false))
([acc piece promoted?]
(if (= piece "")
acc
(let [cursor (get piece 0), piece-followed (subs piece 1)]
(if (= cursor "-")
(recur acc piece-followed true)
(recur
(str acc (if promoted? (string/upper-case cursor) cursor))
piece-followed
false))))))
(def dashed-letter-pattern (new js/RegExp "-[a-z]" "g"))

(defn dashed->camel [x]
(.replace x dashed-letter-pattern (fn [cc pos prop] (.toUpperCase (aget cc 1)))))

(defn ensure-string [x] (cond (string? x) x (keyword? x) (name x) :else (str x)))

Expand Down
Loading

0 comments on commit 9fe10f4

Please sign in to comment.