underscore.string
underscore.string copied to clipboard
problem with humanize on camel cased string
Hello,
I noticed an interesting behavior in the _.humanize() method. When you have a camel cased string such as "eatABurrito" I would expect humanize to return "Eat a burrito" to be returned. Instead I get "Eat aburrito". For example:
_.humanize('thisIsATest')
=> 'This is atest'
// expected 'This is a test'
Thanks!
-- Dylan
Hi,
The problem is underscored. Humanize uses underscored and replaces all the underscores.
equal(_('ThisIsATest').underscored(), 'this_is_a_test');
// actual: this_is_atest
If we fix underscored humanize will work correct to.
I didn't see your solution @stoeffel. Sorry.
no problem ;-)