Skip to content

Commit

Permalink
get rid of some collection arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Nov 25, 2019
1 parent 86bf925 commit 09529a1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
6 changes: 4 additions & 2 deletions packages/core-js-pure/override/internals/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ var InternalStateModule = require('../internals/internal-state');
var setInternalState = InternalStateModule.set;
var internalStateGetterFor = InternalStateModule.getterFor;

module.exports = function (CONSTRUCTOR_NAME, wrapper, common, IS_MAP, IS_WEAK) {
module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
var ADDER = IS_MAP ? 'set' : 'add';
var NativeConstructor = global[CONSTRUCTOR_NAME];
var NativePrototype = NativeConstructor && NativeConstructor.prototype;
var ADDER = IS_MAP ? 'set' : 'add';
var exported = {};
var Constructor;

Expand Down
6 changes: 4 additions & 2 deletions packages/core-js/internals/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ var checkCorrectnessOfIteration = require('../internals/check-correctness-of-ite
var setToStringTag = require('../internals/set-to-string-tag');
var inheritIfRequired = require('../internals/inherit-if-required');

module.exports = function (CONSTRUCTOR_NAME, wrapper, common, IS_MAP, IS_WEAK) {
module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
var ADDER = IS_MAP ? 'set' : 'add';
var NativeConstructor = global[CONSTRUCTOR_NAME];
var NativePrototype = NativeConstructor && NativeConstructor.prototype;
var Constructor = NativeConstructor;
var ADDER = IS_MAP ? 'set' : 'add';
var exported = {};

var fixMethod = function (KEY) {
Expand Down
6 changes: 3 additions & 3 deletions packages/core-js/modules/es.map.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ var collectionStrong = require('../internals/collection-strong');

// `Map` constructor
// https://tc39.github.io/ecma262/#sec-map-objects
module.exports = collection('Map', function (get) {
return function Map() { return get(this, arguments.length ? arguments[0] : undefined); };
}, collectionStrong, true);
module.exports = collection('Map', function (init) {
return function Map() { return init(this, arguments.length ? arguments[0] : undefined); };
}, collectionStrong);
4 changes: 2 additions & 2 deletions packages/core-js/modules/es.set.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ var collectionStrong = require('../internals/collection-strong');

// `Set` constructor
// https://tc39.github.io/ecma262/#sec-set-objects
module.exports = collection('Set', function (get) {
return function Set() { return get(this, arguments.length ? arguments[0] : undefined); };
module.exports = collection('Set', function (init) {
return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
}, collectionStrong);
6 changes: 3 additions & 3 deletions packages/core-js/modules/es.weak-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
var isExtensible = Object.isExtensible;
var InternalWeakMap;

var wrapper = function (get) {
var wrapper = function (init) {
return function WeakMap() {
return get(this, arguments.length ? arguments[0] : undefined);
return init(this, arguments.length ? arguments[0] : undefined);
};
};

// `WeakMap` constructor
// https://tc39.github.io/ecma262/#sec-weakmap-constructor
var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak, true, true);
var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak);

// IE11 WeakMap frozen keys fix
// We can't use feature detection because it crash some old IE builds
Expand Down
6 changes: 3 additions & 3 deletions packages/core-js/modules/es.weak-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ var collectionWeak = require('../internals/collection-weak');

// `WeakSet` constructor
// https://tc39.github.io/ecma262/#sec-weakset-constructor
collection('WeakSet', function (get) {
return function WeakSet() { return get(this, arguments.length ? arguments[0] : undefined); };
}, collectionWeak, false, true);
collection('WeakSet', function (init) {
return function WeakSet() { return init(this, arguments.length ? arguments[0] : undefined); };
}, collectionWeak);

0 comments on commit 09529a1

Please sign in to comment.