Sha256: bbff4e5b6feace8befbe881f529a4912967b9be1a459e6ad670f177f75cf2ef2
Contents?: true
Size: 894 Bytes
Versions: 7
Compression:
Stored size: 894 Bytes
Contents
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); }); };
Version data entries
7 entries across 7 versions & 4 rubygems