Here you can find the source of slugify()
/**//w w w . j av a2 s . c o m * Taken from https://gist.github.com/mathewbyrne/1280286 * * @returns {string} */ String.prototype.slugify = function() { return this.toString().toLowerCase() .replace(/\s+/g, '-') // Replace spaces with - .replace(/[^\w\-]+/g, '') // Remove all non-word chars .replace(/\-\-+/g, '-') // Replace multiple - with single - .replace(/^-+/, '') // Trim - from start of text .replace(/-+$/, ''); // Trim - from end of text };
String.prototype.slug=function(){ return this.toLowerCase().replace(/\s/g,'-').replace(/[^a-zA-Z0-9]/g,'-').replace(/-{2,}/g,'-').replace(/^-/,'').replace(/-$/,'');
import $removeDiacritics from './internal/removeDiacritics'; String.prototype.slug = function(max) { max = max || 60; var self = $removeDiacritics(this.trim().toLowerCase()); var b = ''; var length = self.length; for (var i = 0; i < length; i++) { var c = self[i]; var code = self.charCodeAt(i); ...
String.prototype.slugify = function() { var string = this.replace(/[^\w\s-]/g, '').trim().toLowerCase(); return string.replace(/[_\s]+/g, '_'); };
String.prototype.slugify = function () return this.toLowerCase() .replace(/\s+/g, '-') .replace(/[^\w\-]+/g, '') .replace(/\-\-+/g, '-') .replace(/^-+/, '') .replace(/-+$/, '');
String.prototype.slugify = function () { return this.trim().replace(/\s+/g, '-'); };