underscore.string icon indicating copy to clipboard operation
underscore.string copied to clipboard

problem with humanize on camel cased string

Open dylanswartz opened this issue 11 years ago • 3 comments

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

dylanswartz avatar Jun 28 '14 05:06 dylanswartz

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.

stoeffel avatar Jun 28 '14 08:06 stoeffel

I didn't see your solution @stoeffel. Sorry.

mguilarducci avatar Aug 03 '14 23:08 mguilarducci

no problem ;-)

stoeffel avatar Aug 04 '14 09:08 stoeffel