mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Add support for Object.fromEntries
This provides a simpler way of creating an `Object` from e.g. a `Map`, without having to manually iterate over it. Please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries
This commit is contained in:
parent
95e102c07b
commit
16fa9dc4ea
2 changed files with 10 additions and 5 deletions
|
@ -118,11 +118,7 @@ class Metadata {
|
|||
}
|
||||
|
||||
getAll() {
|
||||
const obj = Object.create(null);
|
||||
for (const [key, value] of this._metadataMap) {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
return Object.fromEntries(this._metadataMap);
|
||||
}
|
||||
|
||||
has(name) {
|
||||
|
|
|
@ -197,6 +197,15 @@ if (
|
|||
require("core-js/es/object/assign.js");
|
||||
})();
|
||||
|
||||
// Provides support for Object.fromEntries in legacy browsers.
|
||||
// Support: IE, Chrome<73
|
||||
(function checkObjectFromEntries() {
|
||||
if (Object.fromEntries) {
|
||||
return;
|
||||
}
|
||||
require("core-js/es/object/from-entries.js");
|
||||
})();
|
||||
|
||||
// Provides support for Math.log2 in legacy browsers.
|
||||
// Support: IE, Chrome<38
|
||||
(function checkMathLog2() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue