From 38592f4a9c3f181c78ab946c13500083bde2b40c Mon Sep 17 00:00:00 2001 From: Denis Pushkarev Date: Mon, 12 Jun 2023 00:37:06 +0700 Subject: [PATCH] workaround IE bug --- packages/core-js/internals/array-group.js | 2 +- packages/core-js/modules/esnext.object.group-by.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/core-js/internals/array-group.js b/packages/core-js/internals/array-group.js index 95a92d1c8cb5..bde99555e7cc 100644 --- a/packages/core-js/internals/array-group.js +++ b/packages/core-js/internals/array-group.js @@ -21,7 +21,7 @@ module.exports = function ($this, callbackfn, that, specificConstructor) { for (;length > index; index++) { value = self[index]; key = toPropertyKey(boundFunction(value, index, O)); - // in some IE10 builds, `hasOwnProperty` returns incorrect result on integer keys + // in some IE versions, `hasOwnProperty` returns incorrect result on integer keys // but since it's a `null` prototype object, we can safely use `in` if (key in target) push(target[key], value); else target[key] = [value]; diff --git a/packages/core-js/modules/esnext.object.group-by.js b/packages/core-js/modules/esnext.object.group-by.js index d84a1b529478..2ad354ae3a09 100644 --- a/packages/core-js/modules/esnext.object.group-by.js +++ b/packages/core-js/modules/esnext.object.group-by.js @@ -4,7 +4,6 @@ var getBuiltIn = require('../internals/get-built-in'); var uncurryThis = require('../internals/function-uncurry-this'); var aCallable = require('../internals/a-callable'); var requireObjectCoercible = require('../internals/require-object-coercible'); -var has = require('../internals/has-own-property'); var toPropertyKey = require('../internals/to-property-key'); var iterate = require('../internals/iterate'); @@ -21,8 +20,10 @@ $({ target: 'Object', stat: true, forced: true }, { var k = 0; iterate(items, function (value) { var key = toPropertyKey(callbackfn(value, k++)); - if (!has(obj, key)) obj[key] = [value]; - else push(obj[key], value); + // in some IE versions, `hasOwnProperty` returns incorrect result on integer keys + // but since it's a `null` prototype object, we can safely use `in` + if (key in obj) push(obj[key], value); + else obj[key] = [value]; }); return obj; }