Skip to content

Commit

Permalink
nit: simplify hasObjectChanges loop
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Nov 28, 2018
1 parent c9e1d98 commit 3c7f374
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,9 @@ function hasObjectChanges(state) {
// Search for added keys. Start at the back, because non-numeric keys
// are ordered by time of definition on the object.
const keys = Object.keys(proxy)
for (let i = keys.length; i !== 0; ) {
const key = keys[--i]

for (let i = keys.length - 1; i >= 0; i--) {
// The `undefined` check is a fast path for pre-existing keys.
if (base[key] === undefined && !has(base, key)) {
if (base[keys[i]] === undefined && !has(base, keys[i])) {
return true
}
}
Expand Down

0 comments on commit 3c7f374

Please sign in to comment.