diff --git a/src/utils/commons.js b/src/utils/commons.js index a2b7c27..76e2b77 100644 --- a/src/utils/commons.js +++ b/src/utils/commons.js @@ -20,6 +20,19 @@ if (!String.prototype.padStart) { }; } +if (!Object.fromEntries) { + Object.fromEntries = function(entries) { + const obj = {}; + for (let i = 0; i < entries.length; ++i) { + const entry = entries[i]; + if (entry && entry.length === 2) { + obj[entry[0]] = entry[1]; + } + } + return obj; + }; +} + export function copy(obj) { return JSON.parse(JSON.stringify(obj)); }