UNPKG

encode-3986

Version:

Like `encodeURIComponent`, but RFC 3986 compliant.

10 lines (7 loc) 210 B
'use strict' var encode = function (string) { return encodeURIComponent(string).replace(/[!'()*]/g, function (c) { return '%' + c.charCodeAt(0).toString(16).toUpperCase() }) } module.exports = encode