Here you can find the source of dasherize()
/** related to: Object.inspect * String#inspect([useDoubleQuotes = false]) -> String * * Returns a debug-oriented version of the string (i.e. wrapped in single or * double quotes, with backslashes and quotes escaped). * * For more information on `inspect` methods, see [[Object.inspect]]. * * #### Examples//from w w w . j av a2s. c om * * 'I\'m so happy.'.inspect(); * // -> '\'I\\\'m so happy.\'' * // (displayed as 'I\'m so happy.' in an alert dialog or the console) * * 'I\'m so happy.'.inspect(true); * // -> '"I'm so happy."' * // (displayed as "I'm so happy." in an alert dialog or the console) **/ String.prototype.dasherize = function() { return this.replace(/_/g, '-'); };
String.prototype.dasherize = function() { return this.replace(/_/g, "-"); };
String.prototype.dasherize = function() { return this.replace(/_/g, "-"); };
String.prototype.dasherize = function() { return this.gsub(/_/,'-'); };
String.prototype.dasherize = function() { return this.replace(/_/g, '-'); };
String.prototype.dasherize = function() { return this.replace(/_/g, "-"); };
String.prototype.toDash = function(){ return this.replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}); };
String.prototype.toDash = function () { var str = this.replace(/([A-Z])/g, function ($1) { return "-" + $1.toLowerCase(); }); return (str[0] == '-' ? str.substring(1) : str); };
String.prototype.toDashCase = function() { return this .replace(/^[A-Z]/, ($1) => { return $1.toLowerCase(); }) .replace(/([A-Z])/g, ($1) => { return '-'+$1.toLowerCase(); }); }; ...
String.prototype.toDashedCase = function() { return this.replace(/([A-Z])/g, function($1){return '-'+$1.toLowerCase();}); };