Skip to content

Commit 1f25729

Browse files
committed
Remove unneccessary array of keys
1 parent 8faf167 commit 1f25729

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ const diff = (lhs, rhs) => {
66

77
if (!isObject(lhs) || !isObject(rhs)) return rhs;
88

9-
const rhsKeys = Object.keys(rhs);
10-
119
const deletedValues = Object.keys(lhs).reduce((acc, key) => {
12-
return rhsKeys.indexOf(key) !== -1 ? acc : { ...acc, [key]: undefined };
10+
return rhs.hasOwnProperty(key) ? acc : { ...acc, [key]: undefined };
1311
}, {});
1412

15-
return rhsKeys.reduce((acc, key) => {
13+
return Object.keys(rhs).reduce((acc, key) => {
1614
if (!lhs.hasOwnProperty(key)) return { ...acc, [key]: rhs[key] };
1715

1816
const difference = diff(lhs[key], rhs[key]);

0 commit comments

Comments
 (0)