github-pages-deploy-action/node_modules/core-js-pure/internals/array-method-uses-to-length.js
2020-03-06 22:45:40 -05:00

28 lines
894 B
JavaScript

var DESCRIPTORS = require('../internals/descriptors');
var fails = require('../internals/fails');
var has = require('../internals/has');
var defineProperty = Object.defineProperty;
var cache = {};
var thrower = function (it) { throw it; };
module.exports = function (METHOD_NAME, options) {
if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];
if (!options) options = {};
var method = [][METHOD_NAME];
var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;
var argument0 = has(options, 0) ? options[0] : thrower;
var argument1 = has(options, 1) ? options[1] : undefined;
return cache[METHOD_NAME] = !!method && !fails(function () {
if (ACCESSORS && !DESCRIPTORS) return true;
var O = { length: -1 };
if (ACCESSORS) defineProperty(O, 1, { enumerable: true, get: thrower });
else O[1] = 1;
method.call(O, argument0, argument1);
});
};