Skip to content

Commit 60b1959

Browse files
committed
avoid usage forEach from prototype on runtime
1 parent 243ee6f commit 60b1959

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/core-js/modules/es.symbol.constructor.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
5252
var nativeDefineProperty = definePropertyModule.f;
5353
var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
5454
var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
55+
var forEach = uncurryThis([].forEach);
5556
var push = uncurryThis([].push);
5657

5758
var AllSymbols = shared('symbols');
@@ -106,7 +107,7 @@ var $defineProperty = function defineProperty(O, P, Attributes) {
106107
var $defineProperties = function defineProperties(O, Properties) {
107108
anObject(O);
108109
var properties = toObject(Properties);
109-
nativeObjectKeys(properties).concat($getOwnPropertySymbols(properties)).forEach(function (key) {
110+
forEach(nativeObjectKeys(properties).concat($getOwnPropertySymbols(properties)), function (key) {
110111
if (call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);
111112
});
112113
return O;
@@ -137,7 +138,7 @@ var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
137138

138139
var $getOwnPropertyNames = function getOwnPropertyNames(O) {
139140
var result = [];
140-
nativeGetOwnPropertyNames(toObject(O)).forEach(function (key) {
141+
forEach(nativeGetOwnPropertyNames(toObject(O)), function (key) {
141142
if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);
142143
});
143144
return result;
@@ -146,7 +147,7 @@ var $getOwnPropertyNames = function getOwnPropertyNames(O) {
146147
var $getOwnPropertySymbols = function (O) {
147148
var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
148149
var result = [];
149-
nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toObject(O)).forEach(function (key) {
150+
forEach(nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toObject(O)), function (key) {
150151
if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {
151152
push(result, AllSymbols[key]);
152153
}
@@ -214,7 +215,7 @@ $({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !
214215
Symbol: $Symbol,
215216
});
216217

217-
nativeObjectKeys(WellKnownSymbolsStore).forEach(function (name) {
218+
forEach(nativeObjectKeys(WellKnownSymbolsStore), function (name) {
218219
defineWellKnownSymbol(name);
219220
});
220221

0 commit comments

Comments
 (0)