aboutsummaryrefslogtreecommitdiff
path: root/node_modules/core-js/modules/library/_collection.js
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/core-js/modules/library/_collection.js
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/core-js/modules/library/_collection.js')
-rw-r--r--node_modules/core-js/modules/library/_collection.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/node_modules/core-js/modules/library/_collection.js b/node_modules/core-js/modules/library/_collection.js
new file mode 100644
index 00000000..31a36b87
--- /dev/null
+++ b/node_modules/core-js/modules/library/_collection.js
@@ -0,0 +1,59 @@
+'use strict';
+var global = require('./_global');
+var $export = require('./_export');
+var meta = require('./_meta');
+var fails = require('./_fails');
+var hide = require('./_hide');
+var redefineAll = require('./_redefine-all');
+var forOf = require('./_for-of');
+var anInstance = require('./_an-instance');
+var isObject = require('./_is-object');
+var setToStringTag = require('./_set-to-string-tag');
+var dP = require('./_object-dp').f;
+var each = require('./_array-methods')(0);
+var DESCRIPTORS = require('./_descriptors');
+
+module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
+ var Base = global[NAME];
+ var C = Base;
+ var ADDER = IS_MAP ? 'set' : 'add';
+ var proto = C && C.prototype;
+ var O = {};
+ if (!DESCRIPTORS || typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {
+ new C().entries().next();
+ }))) {
+ // create collection constructor
+ C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
+ redefineAll(C.prototype, methods);
+ meta.NEED = true;
+ } else {
+ C = wrapper(function (target, iterable) {
+ anInstance(target, C, NAME, '_c');
+ target._c = new Base();
+ if (iterable != undefined) forOf(iterable, IS_MAP, target[ADDER], target);
+ });
+ each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','), function (KEY) {
+ var IS_ADDER = KEY == 'add' || KEY == 'set';
+ if (KEY in proto && !(IS_WEAK && KEY == 'clear')) hide(C.prototype, KEY, function (a, b) {
+ anInstance(this, C, KEY);
+ if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
+ var result = this._c[KEY](a === 0 ? 0 : a, b);
+ return IS_ADDER ? this : result;
+ });
+ });
+ IS_WEAK || dP(C.prototype, 'size', {
+ get: function () {
+ return this._c.size;
+ }
+ });
+ }
+
+ setToStringTag(C, NAME);
+
+ O[NAME] = C;
+ $export($export.G + $export.W + $export.F, O);
+
+ if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
+
+ return C;
+};