We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents cc516d0 + bfe265a commit 5bb35eeCopy full SHA for 5bb35ee
1 file changed
src/display/annotation_storage.js
@@ -260,13 +260,8 @@ class AnnotationStorage {
260
if (key === "type") {
261
continue;
262
}
263
- let counters = map.get(key);
264
- if (!counters) {
265
- counters = new Map();
266
- map.set(key, counters);
267
- }
268
- const count = counters.get(val) ?? 0;
269
- counters.set(val, count + 1);
+ const counters = map.getOrInsertComputed(key, () => new Map());
+ counters.set(val, (counters.get(val) ?? 0) + 1);
270
271
272
if (numberOfDeletedComments > 0 || numberOfEditedComments > 0) {
0 commit comments