Standards compliant percent-encoding
Switch branches/tags
Clone or download
Latest commit 99b90c5 Nov 16, 2015
Failed to load latest commit information.
.travis.yml Add .travis.yml May 22, 2013
AUTHORS initial commit May 22, 2013
LICENSE Add LICENSE (fixes #2) Nov 16, 2015 Add testling badge May 23, 2013
index.js Remove more browsers and the AMD malarkey Oct 24, 2013
package.json 1.0.2 Nov 16, 2015
test.js Require index.js in test May 25, 2013


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

browser support


var pctEncode = require('pct-encode')

var encode = pctEncode(/\W/g);

console.log(encode("UTF-8 in your URIs: ✓")); // UTF-8%20in%20your%20URIs%3A%20%E2%9C%93


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

Given a regular expression, this returns a function that takes a string and returns a copy with characters that match regexp percent-encoded.