Skip to content

Commit

Permalink
optimize Map / Set clearing
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Dec 14, 2023
1 parent 6355a4d commit ea70d36
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/core-js/internals/collection-strong.js
Expand Up @@ -80,15 +80,14 @@ module.exports = {
clear: function clear() {
var that = this;
var state = getInternalState(that);
var data = state.index;
var entry = state.first;
while (entry) {
entry.removed = true;
if (entry.previous) entry.previous = entry.previous.next = undefined;
delete data[entry.index];
entry = entry.next;
}
state.first = state.last = undefined;
state.index = create(null);
if (DESCRIPTORS) state.size = 0;
else that.size = 0;
},
Expand Down

0 comments on commit ea70d36

Please sign in to comment.