mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-22 16:05:56 +02:00
Use Map.prototype.getOrInsert() in the getNewAnnotationsMap helper
This commit is contained in:
parent
f548a159d6
commit
76a5aed05f
@ -669,12 +669,7 @@ function getNewAnnotationsMap(annotationStorage) {
|
|||||||
if (!key.startsWith(AnnotationEditorPrefix)) {
|
if (!key.startsWith(AnnotationEditorPrefix)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let annotations = newAnnotationsByPage.get(value.pageIndex);
|
newAnnotationsByPage.getOrInsert(value.pageIndex, []).push(value);
|
||||||
if (!annotations) {
|
|
||||||
annotations = [];
|
|
||||||
newAnnotationsByPage.set(value.pageIndex, annotations);
|
|
||||||
}
|
|
||||||
annotations.push(value);
|
|
||||||
}
|
}
|
||||||
return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
|
return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user