form-urlencoded
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -9,10 +9,14 @@ // Filename: formurlencoded.js | ||
var formurlencoded = module.exports = function (data, opts) { | ||
// ES5 compatible version of `/[^ !'()~\*]/gu`, https://mothereff.in/regexpu | ||
var encodechar = new RegExp([ | ||
'(?:[\0-\x1F"-&\+-\}\x7F-\uD7FF\uE000-\uFFFF]|', | ||
'[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|', | ||
'(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])' | ||
].join(''), 'g'); | ||
opts = typeof opts === 'object' ? opts : {}; | ||
function encode (value) { | ||
return String(value) | ||
// The following is an ES5 compatible version of .replace(/[^ !'()~\*]/gu, encodeURIComponent) | ||
// Thanks to https://mothereff.in/regexpu | ||
.replace(/(?:[\0-\x1F"-&\+-\}\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g, encodeURIComponent) | ||
.replace(encodechar, encodeURIComponent) | ||
.replace(/ /g, '+') | ||
@@ -19,0 +23,0 @@ .replace(/[!'()~\*]/g, function (ch) { |
{ | ||
"name": "form-urlencoded", | ||
"main": "form-urlencoded", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "Return an object as an 'x-www-form-urlencoded' string", | ||
@@ -6,0 +6,0 @@ "author": "Chris <chris@bumblehead.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12468
207