simontonsoftware / s-libs

A collection of libraries for any of javascript, rxjs, or angular.
MIT License
43 stars 5 forks source link

[micro-dash] Bug in kebabCase #110

Closed luhis closed 1 year ago

luhis commented 1 year ago

Hi,

I have found a difference vs Lodash in the kebabCase function.

kebabCase("2013 5th November") gives "2013-5th-november" in Lodash, but "2013-5-th-november" in micro-dash. It looks like a bug in the words function. I've not looked into it much yet.

Matt

ersimont commented 1 year ago

Thank you for caring about the library enough to open an issue!

This is expected behavior. It's documented in the readme under "Differences from Lodash":

String functions are designed for simple cases like variable names. They only treat [0-9A-Za-z] as part of words and are not smart about contractions or ordinals (e.g. I'll or 1st).

This is intentional because matching Lodash's string parsing is a slippery slope that ends in their regex file that looks like this. In the spirit of micro-dash, I made the decision to keep things simpler and smaller.

I'll close this ticket, but please feel free to argue for an exception in light of this. And I hope you find at least the rest of the library meets all your needs!