Skip to content

Commit

Permalink
fix: use copy logObject when unset properties
Browse files Browse the repository at this point in the history
  • Loading branch information
yidinghan committed Aug 29, 2017
1 parent 0fc1c5b commit 78bee31
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,16 @@ exports.keysRecorder = (payload = {}) => {
return (target) => {
if (!target) { return {}; }

const logObject = {};
let logObject = {};
finalSelects.forEach((path) => {
set(logObject, path, get(target, path));
});
unselects.forEach((path) => {
unset(logObject, path);
});
if (unselects.length) {
logObject = JSON.parse(JSON.stringify(logObject));
unselects.forEach((path) => {
unset(logObject, path);
});
}

return logObject;
};
Expand Down

0 comments on commit 78bee31

Please sign in to comment.