Hi,

I've written a small library (1 ns, 100 lines) to transform nested maps 
from "dash-case" keys to "camelCase" keys and back.

The original use case was taking MySQL records that use camelCase field 
names and convert them to dash-case so they don't stick out like a sore 
thumb in my code. Similarly, when writing new records into the DB, I wanted 
to camelize them back before passing to JDBC.

It should work on an arbitrarily deep nested map without blowing the stack 
(using zipper).

It is symmetric:

(dasherize "clientOSVersion")
=> "client-OS-version"
(camelize "client-OS-version")
=> "clientOSVersion"


The library starts with defining functions that work on strings, then ones 
that work on keywords (internally calling the string ones) and later ones 
working on maps (that assume all keys are keywords and use the keyword 
functions). Lastly, the library defines protocols that will ease working 
with different types.

I would love any feedback, but especially:
- is there any off-the-shelf library for this already?
- I found zipper and regex to be really hurting performance here, anything 
you would do differently to improve this?
- anything about style... I'm writing Clojure for a year and didn't get 
much code reviews.

the gist is here:

https://gist.github.com/NoamB/6e940775dfa63c73ee9c

Thanks.

PS - I took the string versions of the functions from cuerdas 
(https://github.com/funcool/cuerdas) and modified a bit, mainly to get the 
symmetry working.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to