Skip to content

Commit

Permalink
Inline this function.
Browse files Browse the repository at this point in the history
  • Loading branch information
timdorr committed Nov 22, 2019
1 parent 1186016 commit 58ae5ed
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/utils/shallowEqual.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const hasOwn = Object.prototype.hasOwnProperty

function is(x, y) {
if (x === y) {
return x !== 0 || y !== 0 || 1 / x === 1 / y
Expand All @@ -26,7 +24,10 @@ export default function shallowEqual(objA, objB) {
if (keysA.length !== keysB.length) return false

for (let i = 0; i < keysA.length; i++) {
if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
if (
!Object.prototype.hasOwnProperty.call(objB, keysA[i]) ||
!is(objA[keysA[i]], objB[keysA[i]])
) {
return false
}
}
Expand Down

0 comments on commit 58ae5ed

Please sign in to comment.