Skip to content

Commit

Permalink
perf: remove unnecessary object clone
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Oct 6, 2022
1 parent 0123e12 commit f199e94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ unreleased
==========

* deps: qs@6.11.0
* perf: remove unnecessary object clone

1.20.0 / 2022-04-02
===================
Expand Down
17 changes: 8 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,15 @@ Object.defineProperty(exports, 'urlencoded', {
*/

function bodyParser (options) {
var opts = {}

// exclude type option
if (options) {
for (var prop in options) {
if (prop !== 'type') {
opts[prop] = options[prop]
}
// use default type for parsers
var opts = Object.create(options || null, {
type: {
configurable: true,
enumerable: true,
value: undefined,
writable: true
}
}
})

var _urlencoded = exports.urlencoded(opts)
var _json = exports.json(opts)
Expand Down

0 comments on commit f199e94

Please sign in to comment.