Nodejs Utililty Methods String Dasherize

List of utility methods to do String Dasherize

Description

The list of methods to do String Dasherize are organized into topic(s).

Method

dasherize()
String.prototype.dasherize = function() {
  return this.replace(/_/g, "-");
};
dasherize()
String.prototype.dasherize = function() {
  return this.replace(/_/g, "-");
};
dasherize()
String.prototype.dasherize = function() {
  return this.gsub(/_/,'-');
};
dasherize()
String.prototype.dasherize = function() {
  return this.replace(/_/g, '-');
};
dasherize()
String.prototype.dasherize = function() {
  return this.replace(/_/g, "-");
};
dasherize()
String.prototype.dasherize = function() {
  return this.replace(/_/g, '-');
};
toDash()
String.prototype.toDash = function(){
  return this.replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();});
};
toDash()
String.prototype.toDash = function () {
  var str = this.replace(/([A-Z])/g, function ($1) { return "-" + $1.toLowerCase(); });
  return (str[0] == '-' ? str.substring(1) : str);
};
toDashCase()
String.prototype.toDashCase = function() {
  return this
          .replace(/^[A-Z]/, ($1) => {
            return $1.toLowerCase();
          })
          .replace(/([A-Z])/g, ($1) => {
            return '-'+$1.toLowerCase();
          });
};
...
toDashedCase()
String.prototype.toDashedCase = function() {
  return this.replace(/([A-Z])/g, function($1){return '-'+$1.toLowerCase();});
};