Skip to content

Commit

Permalink
Merge pull request #12179 from Snuffleupagus/Object.fromEntries
Browse files Browse the repository at this point in the history
Add support for `Object.fromEntries`
  • Loading branch information
timvandermeij authored Aug 6, 2020
2 parents 95e102c + 16fa9dc commit b99b3b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/display/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 9 additions & 0 deletions src/shared/compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit b99b3b6

Please sign in to comment.