diff --git a/packages/xo-collection/src/index.js b/packages/xo-collection/src/index.js index 3a321e619..5fb4b9392 100644 --- a/packages/xo-collection/src/index.js +++ b/packages/xo-collection/src/index.js @@ -99,14 +99,14 @@ export default class Index { const prev = keysToHash[key] const hash = computeHash(value, key) - if (hash === prev) { - continue - } - if (prev != null) { - delete itemsByHash[prev][key] - } + // Same hash, nothing to do. + if (hash === prev) continue + // Removes item from the previous hash's list if any. + if (prev != null) delete itemsByHash[prev][key] + + // Inserts item into the new hash's list if any. if (hash != null) { ( itemsByHash[hash] ||