Quick port of the rust heck crate to roc - convert any string to various casings:
Neat, I remember implementing something similar for roc-json with plans to roll it into the ascii package someday. It was definitely non-trivial, so will be nice to have a real package to do it.
Here's my version in case you're interested https://github.com/lukewilliamboswell/roc-json/blob/main/package/StringFormat.roc
Oh yeah… Of course you would have had to implement this for roc-json. I can't take credit for the implementation here, as I just ported from rust, but it’s a pretty minimal algorithm. All boils down to about a 40 line transform algorithm which accepts a function to transform a word, and a function to insert a divider.
I can probably clean up the roc implementation a little, but I kept it close to the rust code to begin with.
Last updated: Jul 26 2025 at 12:14 UTC