From 76a5aed05f1e69be551a66abb212c891f1f2a11a Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 21 Feb 2026 10:56:10 +0100 Subject: [PATCH] Use `Map.prototype.getOrInsert()` in the `getNewAnnotationsMap` helper --- src/core/core_utils.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/core/core_utils.js b/src/core/core_utils.js index 5980a51f2..85aedf03b 100644 --- a/src/core/core_utils.js +++ b/src/core/core_utils.js @@ -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; }