Skip to content

Commit 07bf279

Browse files
committed
fix collections wrappers in the pure version
1 parent 4e06f85 commit 07bf279

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

packages/core-js-pure/override/internals/collection.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ var isCallable = require('../internals/is-callable');
99
var isObject = require('../internals/is-object');
1010
var isNullOrUndefined = require('../internals/is-null-or-undefined');
1111
var setToStringTag = require('../internals/set-to-string-tag');
12+
var wellKnownSymbol = require('../internals/well-known-symbol');
13+
14+
var ITERATOR = wellKnownSymbol('iterator');
1215
var setInternalState = require('../internals/internal-state').set;
1316
var internalStateGetterFor = require('../internals/internal-state-getter-for');
1417

@@ -22,7 +25,7 @@ module.exports = function (CONSTRUCTOR_NAME, wrapper, common, FORCED) {
2225
var Constructor;
2326

2427
var REPLACE = FORCED || !isCallable(NativeConstructor)
25-
|| !(IS_WEAK || (NativePrototype.forEach && common.ensureIterators(Constructor, CONSTRUCTOR_NAME, IS_MAP)));
28+
|| !(IS_WEAK || (NativePrototype.forEach && common.ensureIterators(NativeConstructor, CONSTRUCTOR_NAME, IS_MAP)));
2629

2730
if (REPLACE) {
2831
// create collection constructor
@@ -55,12 +58,16 @@ module.exports = function (CONSTRUCTOR_NAME, wrapper, common, FORCED) {
5558
}
5659
});
5760

58-
IS_WEAK || Object.defineProperty(Prototype, 'size', {
59-
configurable: true,
60-
get: function () {
61-
return getInternalState(this).collection.size;
62-
},
63-
});
61+
if (!IS_WEAK) {
62+
Object.defineProperty(Prototype, 'size', {
63+
configurable: true,
64+
get: function () {
65+
return getInternalState(this).collection.size;
66+
},
67+
});
68+
69+
createNonEnumerableProperty(Prototype, ITERATOR, Prototype[IS_MAP ? 'entries' : 'values']);
70+
}
6471
}
6572

6673
setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);

0 commit comments

Comments
 (0)