index.js
function changeCase(str) {
  if (str == null) return '';
  str = String(str);
  str = str.replace(/\./g, 'zzz')
  str = str.replace(/_/g, '-')
  str = str.replace(/([A-Z]+)/g, function (_, $1) {
    return '-' + $1.toLowerCase();
  });
  str = str.replace(/[^a-z-]+/g, '-')
  str = str.replace(/^[-\s]+|[-\s]+$/g, '');
  str = str.replace(/zzz/g, '.');
  return str;
}
function changeCase(str) {
  if (str == null) return '';
  str = String(str);
  str = str.replace(/\./g, 'zzz')
  str = str.replace(/_/g, '-')
  str = str.replace(/([A-Z]+)/g, function (_, $1) {
    return '-' + $1.toLowerCase();
  });
  str = str.replace(/[^a-z-]+/g, '-')
  str = str.replace(/^[-\s]+|[-\s]+$/g, '');
  str = str.replace(/zzz/g, '.');
  return str;
}
function changeCase ( str ) { if ( str == null ) return '' ; str = String ( str ) ; str = str . replace ( / \. / g , 'zzz' ) str = str . replace ( / _ / g , '-' ) str = str . replace ( / ([A-Z]+) / g , function ( _ , $1 ) { return '-' + $1 . toLowerCase ( ) ; } ) ; str = str . replace ( / [^a-z-]+ / g , '-' ) str = str . replace ( / ^[-\s]+|[-\s]+$ / g , '' ) ; str = str . replace ( / zzz / g , '.' ) ; return str ; }
Convert camelcase to slugs, remove leading and trailing
dashes and whitespace. Convert underscores to dashes.

@param  {String} `str`
@return {String}
Convert camelcase to slugs remove leading and trailing dashes and whitespace . Convert underscores to dashes .