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

Fix underscore for single word

Open az7arul opened this issue 9 years ago • 4 comments

az7arul avatar Mar 16 '15 15:03 az7arul

https://github.com/jprichardson/string.js/issues/86

az7arul avatar Mar 16 '15 18:03 az7arul

any feedback on this ?

az7arul avatar May 30 '15 19:05 az7arul

I will check it tomorrow

stoeffel avatar May 30 '15 21:05 stoeffel

I think if we change the behaviour of underscored we should change dasherize too. WIth your change they would behave differently. i.e.


dasherize('oneAtATime'); // => 'one-at-a-time'
dasherize('ATime'); // => '-a-time'
dasherize('ONETime'); // => '-o-n-e-time'

underscored('oneAtATime'); // => 'one_at_a_time'
underscored('ATime'); // => 'a_time'
underscored('ONETime'); // => 'one_time'

The only different should be that dasherize prefixes the sting with a dash if it starts with an uppercase.

@epeli do you agree that we should change both functions to the behaviour proposed by @az7arul ?

btw. related #89 #156

stoeffel avatar May 31 '15 11:05 stoeffel