underscore.string
underscore.string copied to clipboard
Fix underscore for single word
https://github.com/jprichardson/string.js/issues/86
any feedback on this ?
I will check it tomorrow
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