"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Source: https://github.com/tc39/proposal-object-from-entries/blob/master/polyfill.js
* @category polyfill
* @module polyfillObjectFromEntries
*/
var polyfillObjectFromEntries = function () {
// @ts-expect-error: This is validating
if (!Object.fromEntries) {
// @ts-expect-error: This is a polyfill
Object.fromEntries = function ObjectFromEntries(iter) {
var obj = {};
for (var _i = 0, iter_1 = iter; _i < iter_1.length; _i++) {
var pair = iter_1[_i];
if (Object(pair) !== pair)
throw new TypeError('iterable for fromEntries should yield objects');
/*
* Consistency with Map: contract is that entry has "0" and "1" keys, not
* that it is an array or iterable.
*/
var key = pair[0], val = pair[1];
Object.defineProperty(obj, key, {
configurable: true,
enumerable: true,
writable: true,
value: val,
});
}
return obj;
};
}
};
exports.default = polyfillObjectFromEntries;
Source