<commit_before>(ns pump.def-macros)

(defmacro defr
  [name body]
  `(def ~name (pump.core/react (assoc ~body :displayName name))))
<commit_msg>defr macro now converts dashed-names in props to camelCase<commit_after>(ns pump.def-macros
  (:require [clojure.string :as string]))

(defn dash-to-camel-name
  [name]
  (let [words (string/split name #"-")
        camels (map string/capitalize (rest words))
        complete (apply str (first words) camels)]
    complete))

(defn dash-to-camel-keys
  [hashmap]
  (into {} (for [[k v] hashmap]
             [(keyword (dash-to-camel-name (name k))) v])))

(defmacro defr
  [name body]
  (let [cameled# (dash-to-camel-keys body)
        body# (assoc cameled# :displayName name)]
    `(def ~name (pump.core/react ~body#))))

{'fraction_non_alphanumeric': 0.1590612777053455, 'fraction_numerical': 0.0, 'mean_word_length': 3.491228070175439, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1744784', 'n_tokens_mistral': 286, 'n_tokens_neox': 277, 'n_words': 76}