src/utils.js
/**
 * Convert a camel-case or snake-case string into a hyphenated one
 *
 * @param {str} str String to hyphenate
 */
Convert a camel-case or snake-case string into a hyphenated one
@param {str} str String to hyphenate
Convert a camel - case or snake - case string into a hyphenated one @param { str } str String to hyphenate
function toHyphenated (str) {
  const out = [];
  for (let i = 0; i < str.length; i++) {
    const char = str.charAt(i);
    if (char.toUpperCase() === char && char.toLowerCase() !== char) {
      out.push('-');
      out.push(char.toLowerCase());
    } else {
      out.push(char);
    }
  }
  return out.join('');
}
function toHyphenated ( str ) { const out = [ ] ; for ( let i = 0 ; i < str . length ; i ++ ) { const char = str . charAt ( i ) ; if ( char . toUpperCase ( ) === char && char . toLowerCase ( ) !== char ) { out . push ( '-' ) ; out . push ( char . toLowerCase ( ) ) ; } else { out . push ( char ) ; } } return out . join ( '' ) ; }
Convert a camel-case or snake-case string into a hyphenated one
 @param {str} str String to hyphenate
Convert a camel - case or snake - case string into a hyphenated one @param { str } str String to hyphenate