Skip to content

Commit

Permalink
resolve issue 10, regexp becomes broken when uglified
Browse files Browse the repository at this point in the history
  • Loading branch information
bumblehead committed Jul 17, 2017
1 parent 669df7e commit 448568b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions form-urlencoded.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ module.exports = (data, opts = {}) => {
skipIndex = Boolean(opts.skipIndex),
ignorenull = Boolean(opts.ignorenull),

// ES5 compatible version of `/[^ !'()~\*]/gu`, https://mothereff.in/regexpu
encodechar = new RegExp(['(?:[\0-\x1F"-&\+-\}\x7F-\uD7FF\uE000-\uFFFF]|',
'[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|',
'(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])'].join(''), 'g'),
// ES5 compatible version of `/[^ !'()~\*]/gu`, https://mothereff.in/regexpu
encodechar = /(?:[\0-\x1F"-&\+-\}\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,

encode = value => String(value)
.replace(encodechar, encodeURIComponent)
Expand Down Expand Up @@ -50,4 +48,4 @@ module.exports = (data, opts = {}) => {
};

return data && filterjoin(keys(data).map(key => nest(key, data[key])));
};
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "form-urlencoded",
"main": "form-urlencoded",
"version": "2.0.0",
"version": "2.0.1",
"description": "Return an object as an 'x-www-form-urlencoded' string",
"author": "Chris <chris@bumblehead.com>",
"license": "MIT",
Expand Down

0 comments on commit 448568b

Please sign in to comment.