pub-util.js
function slugify(s, opts) {
  opts = opts || {};
  s = str(s);
  if (!opts.mixedCase) { s = s.toLowerCase(); }
  return s
    .replace(/&/g, '-and-')
    .replace(/\+/g, '-plus-')
    .replace((opts.allow ?
      new RegExp('[^-.a-zA-Z0-9' + _.escapeRegExp(opts.allow) + ']+', 'g') :
      /[^-.a-zA-Z0-9]+/g), '-')
    .replace(/--+/g, '-')
    .replace(/^-(.)/, '$1')
    .replace(/(.)-$/, '$1');
}
function slugify(s, opts) {
  opts = opts || {};
  s = str(s);
  if (!opts.mixedCase) { s = s.toLowerCase(); }
  return s
    .replace(/&/g, '-and-')
    .replace(/\+/g, '-plus-')
    .replace((opts.allow ?
      new RegExp('[^-.a-zA-Z0-9' + _.escapeRegExp(opts.allow) + ']+', 'g') :
      /[^-.a-zA-Z0-9]+/g), '-')
    .replace(/--+/g, '-')
    .replace(/^-(.)/, '$1')
    .replace(/(.)-$/, '$1');
}
function slugify ( s , opts ) { opts = opts || { } ; s = str ( s ) ; if ( ! opts . mixedCase ) { s = s . toLowerCase ( ) ; } return s . replace ( / & / g , '-and-' ) . replace ( / \+ / g , '-plus-' ) . replace ( ( opts . allow ? new RegExp ( '[^-.a-zA-Z0-9' + _ . escapeRegExp ( opts . allow ) + ']+' , 'g' ) : / [^-.a-zA-Z0-9]+ / g ) , '-' ) . replace ( / --+ / g , '-' ) . replace ( / ^-(.) / , '$1' ) . replace ( / (.)-$ / , '$1' ) ; }
convert names to slugified url strings containing only - . a-z 0-9 opts.noprefix => remove leading numbers opts.mixedCase => don't lowercase opts.allow => string of additional characters to allow
convert names to slugified url strings containing only - . a - z 0 - 9 opts . noprefix = > remove leading numbers opts . mixedCase = > don t lowercase opts . allow = > string of additional characters to allow