Cool! I'm glad you found it useful :-) On Wednesday, January 7, 2015 2:12:35 AM UTC+2, Andrey Antukh wrote: > > Hi! > > 2015-01-06 20:25 GMT+01:00 Noam Ben-Ari <[email protected] <javascript:>>: > >> 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. >> > > I have ported some changes from your dasherize version to cuerdas. Thank > you very much for improved version. > > Cheers. > Andrey > > >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to [email protected] >> <javascript:> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> 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 [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Andrey Antukh - Андрей Антух - <[email protected] <javascript:>> / < > [email protected] <javascript:>> > http://www.niwi.be <http://www.niwi.be/page/about/> > https://github.com/niwibe >
-- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
