We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8faf167 commit 1f25729Copy full SHA for 1f25729
src/index.js
@@ -6,13 +6,11 @@ const diff = (lhs, rhs) => {
6
7
if (!isObject(lhs) || !isObject(rhs)) return rhs;
8
9
- const rhsKeys = Object.keys(rhs);
10
-
11
const deletedValues = Object.keys(lhs).reduce((acc, key) => {
12
- return rhsKeys.indexOf(key) !== -1 ? acc : { ...acc, [key]: undefined };
+ return rhs.hasOwnProperty(key) ? acc : { ...acc, [key]: undefined };
13
}, {});
14
15
- return rhsKeys.reduce((acc, key) => {
+ return Object.keys(rhs).reduce((acc, key) => {
16
if (!lhs.hasOwnProperty(key)) return { ...acc, [key]: rhs[key] };
17
18
const difference = diff(lhs[key], rhs[key]);
0 commit comments