Skip to content

Commit

Permalink
workaround IE bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Jun 11, 2023
1 parent 867540b commit 38592f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/core-js/internals/array-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
7 changes: 4 additions & 3 deletions packages/core-js/modules/esnext.object.group-by.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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;
}
Expand Down

0 comments on commit 38592f4

Please sign in to comment.