can.underscore

  • function
 

Takes a CamelCase or mixedCase string and underscores the string on the capital letter.

can.underscore(str)

Parameters

  1. str {String}

    The string to underscore

Returns

{String}

the underscored string

can.underscore takes a CamelCase or mixedCase string and underscores the string on the capital letter. If parts of the string are not CamelCase or mixedCase, it will not change them. can.underscore will lower case the entire string as well.

can.underscore("OneTwo") //-> "one_two"
can.underscore("OneTwo threeFour") //-> "one_two three_four"