For my RSS to micropub implementation I needed to generate a decent slug in JS. I found this slugify.js gist by codeguy to which a coder called thierryc made some really nice modifications (but weirdly didn’t publish their own that I could find).
I tested thierry’s code in jsfiddle and found it left a trailing ‘-‘. Using the fiddle I was able to step through the code and see where it went wrong. I just added an extra replace and it worked for me.
I’ve never really found a use for jsfiddle or gists before so this felt good.