Source

polyfill/polyfillObjectValuesEntries.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Source: https://github.com/tc39/proposal-object-values-entries/blob/master/polyfill.js
 * @category polyfill
 * @module polyfillObjectValuesEntries
 */
var polyfillObjectValuesEntries = function () {
    // @ts-expect-error: @TODO: Fix type
    var reduce = Function.bind.call(Function.call, Array.prototype.reduce);
    // @ts-expect-error: @TODO: Fix type
    var isEnumerable = Function.bind.call(Function.call, Object.prototype.propertyIsEnumerable);
    // @ts-expect-error: @TODO: Fix type
    var concat = Function.bind.call(Function.call, Array.prototype.concat);
    var keys = Reflect.ownKeys;
    if (!Object.values) {
        // @ts-expect-error: This is a polyfill
        Object.values = function values(O) {
            // @ts-expect-error: @TODO: Fix type
            return reduce(keys(O), function (v, k) { return concat(v, typeof k === 'string' && isEnumerable(O, k) ? [O[k]] : []); }, []);
        };
    }
    if (!Object.entries) {
        // @ts-expect-error: This is a polyfill
        Object.entries = function entries(O) {
            // @ts-expect-error: @TODO: Fix type
            return reduce(keys(O), function (e, k) { return concat(e, typeof k === 'string' && isEnumerable(O, k) ? [[k, O[k]]] : []); }, []);
        };
    }
};
exports.default = polyfillObjectValuesEntries;