Skip to content

Commit 76a5aed

Browse files
committed
Use Map.prototype.getOrInsert() in the getNewAnnotationsMap helper
1 parent f548a15 commit 76a5aed

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

src/core/core_utils.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -669,12 +669,7 @@ function getNewAnnotationsMap(annotationStorage) {
669669
if (!key.startsWith(AnnotationEditorPrefix)) {
670670
continue;
671671
}
672-
let annotations = newAnnotationsByPage.get(value.pageIndex);
673-
if (!annotations) {
674-
annotations = [];
675-
newAnnotationsByPage.set(value.pageIndex, annotations);
676-
}
677-
annotations.push(value);
672+
newAnnotationsByPage.getOrInsert(value.pageIndex, []).push(value);
678673
}
679674
return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
680675
}

0 commit comments

Comments
 (0)