mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Simplify the newRefs
computation in the "SaveDocument"-handler in the worker-thread
- Let the `Page.save`-method filter out "empty" entries, similar to the `Page._parsedAnnotations`-getter, since that on its own already simplifies the "SaveDocument"-handler a tiny bit. - The existing `reduce` and `concat` construction isn't exactly a wonder of readability :-) Thanks to modern JavaScript features it should be possible to replace all of this with `Array.prototype.flat()` instead, which at least to me feels a lot easier to understand.
This commit is contained in:
parent
45de73bd00
commit
57c10ac213
2 changed files with 4 additions and 6 deletions
|
@ -349,7 +349,9 @@ class Page {
|
|||
);
|
||||
}
|
||||
|
||||
return Promise.all(newRefsPromises);
|
||||
return Promise.all(newRefsPromises).then(function (newRefs) {
|
||||
return newRefs.filter(newRef => !!newRef);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue