Skip to content

Commit

Permalink
clone object first in map values
Browse files Browse the repository at this point in the history
  • Loading branch information
pranaygp committed Apr 12, 2024
1 parent d013ed2 commit 747ad2d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/match_body.js
Expand Up @@ -63,10 +63,11 @@ module.exports = function matchBody(options, spec, body) {

function mapValues(object, cb) {
const keys = Object.keys(object)
const clonedObject = { ...object }
for (const key of keys) {
object[key] = cb(object[key], key, object)
clonedObject[key] = cb(clonedObject[key], key, clonedObject)
}
return object
return clonedObject
}

/**
Expand Down

0 comments on commit 747ad2d

Please sign in to comment.