Fork Me

toggle

exports

method
module.exports()

Option name Type Description
str String string to apply token replacements on

Helper that replaces some characters with a url safe word or other
character - used primarily to generate url-safe category names.

  • + -> plus
  • # -> sharp
  • / -> _
module.exports = function(str) {

  str = str || '';

  str = str.replace(/\+/g, 'plus');
  str = str.replace(/\//g, '_');
  str = str.replace(/#/g, 'sharp');

  return str;
};