Sha256: 46dce1942679e6d3a913ffeb761a8a177f7371241e9083d4e1fe453cc6c06953
Contents?: true
Size: 1.51 KB
Versions: 62
Compression:
Stored size: 1.51 KB
Contents
/* */ 'use strict'; var $ = require('./$'), $def = require('./$.def'), hide = require('./$.hide'), BUGGY = require('./$.iter-buggy'), forOf = require('./$.for-of'), strictNew = require('./$.strict-new'); module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { var Base = require('./$.global')[NAME], C = Base, ADDER = IS_MAP ? 'set' : 'add', proto = C && C.prototype, O = {}; if (!require('./$.support-desc') || typeof C != 'function' || !(IS_WEAK || !BUGGY && proto.forEach && proto.entries)) { C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); require('./$.mix')(C.prototype, methods); } else { C = wrapper(function(target, iterable) { strictNew(target, C, NAME); target._c = new Base; if (iterable != undefined) forOf(iterable, IS_MAP, target[ADDER], target); }); $.each.call('add,clear,delete,forEach,get,has,set,keys,values,entries'.split(','), function(KEY) { var chain = KEY == 'add' || KEY == 'set'; if (KEY in proto && !(IS_WEAK && KEY == 'clear')) hide(C.prototype, KEY, function(a, b) { var result = this._c[KEY](a === 0 ? 0 : a, b); return chain ? this : result; }); }); if ('size' in proto) $.setDesc(C.prototype, 'size', {get: function() { return this._c.size; }}); } require('./$.tag')(C, NAME); O[NAME] = C; $def($def.G + $def.W + $def.F, O); if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP); return C; };
Version data entries
62 entries across 31 versions & 1 rubygems