mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-09 23:04:02 +02:00
Use Map.prototype.getOrInsertComputed() in the editorStats getter
This commit is contained in:
parent
cc516d0dd4
commit
bfe265ad31
@ -260,13 +260,8 @@ class AnnotationStorage {
|
||||
if (key === "type") {
|
||||
continue;
|
||||
}
|
||||
let counters = map.get(key);
|
||||
if (!counters) {
|
||||
counters = new Map();
|
||||
map.set(key, counters);
|
||||
}
|
||||
const count = counters.get(val) ?? 0;
|
||||
counters.set(val, count + 1);
|
||||
const counters = map.getOrInsertComputed(key, () => new Map());
|
||||
counters.set(val, (counters.get(val) ?? 0) + 1);
|
||||
}
|
||||
}
|
||||
if (numberOfDeletedComments > 0 || numberOfEditedComments > 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user