mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-09 23:04:02 +02:00
Merge pull request #20702 from Snuffleupagus/getNewAnnotationsMap-getOrInsert
Use `Map.prototype.getOrInsert()` in the `getNewAnnotationsMap` helper
This commit is contained in:
commit
2631750038
@ -669,12 +669,7 @@ function getNewAnnotationsMap(annotationStorage) {
|
||||
if (!key.startsWith(AnnotationEditorPrefix)) {
|
||||
continue;
|
||||
}
|
||||
let annotations = newAnnotationsByPage.get(value.pageIndex);
|
||||
if (!annotations) {
|
||||
annotations = [];
|
||||
newAnnotationsByPage.set(value.pageIndex, annotations);
|
||||
}
|
||||
annotations.push(value);
|
||||
newAnnotationsByPage.getOrInsert(value.pageIndex, []).push(value);
|
||||
}
|
||||
return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user