Dasherize String - Node.js String

Node.js examples for String:String Value

Description

Dasherize String

Demo Code


if (!String.prototype.dasherize) {
  String.prototype.dasherize = function() {
    return this/*  www  .j  a v  a  2  s.com*/
      .replace(/([a-z])([A-Z])/g, '$1-$2')
      .replace(/[ _-]+/g, '-')
      .toLowerCase();
  };
}

Related Tutorials