pct-encode

Percent-encode characters in strings matching a regular expression

pct-encode

Create versions of strings where characters that match a regular expression are percent encoded.

 
var pctEncode = require('pct-encode')
 
var encode = pctEncode(/\W/);
 
console.log(encode("UTF-8 in your URIs: ✓"));

module.exports = function (regexp) -> function (string)