node-slug
node-slug copied to clipboard
Feature suggestion: optionally add padding to mapped words
adding
if(opts.padMappedWords && char.length >1) char=' '+char+' '
after the chars have been mapped would allow
slug('m&m'); //=> 'mandm'
slug('i♥u'); //=> 'iloveu'
slug('m&m',{padMappedWords:true}); //=> 'm-and-m'
slug('i♥u',{padMappedWords:true}); //=> 'i-love-u'
how about:
slug('i♥u'.replace(/(\w+)/g, " $1 ")); //=> 'i-love-u'