Skip to content

Commit

Permalink
smoothed behavior of some conflicting proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Dec 22, 2022
1 parent ebe0286 commit 68c9bf6
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
- Added Quest Browser 24.0 compat data mapping
- Fixed the first version in the Chromium-based Edge compat data mapping
- `{ Map, WeakMap }.prototype.emplace` became stricter [by the spec draft](https://tc39.es/proposal-upsert/)
- Smoothed behavior of some conflicting proposals
- Removed some generic behavior (like `@@species` pattern) of some `.prototype` methods from the [new collections methods proposal](https://github.com/tc39/proposal-collection-methods) and the [`Array` deduplication proposal](https://github.com/tc39/proposal-array-unique) that *most likely* will not be implemented since it contradicts the current TC39 policy
- Added pure version of the `Number` constructor, [#1154](https://github.com/zloirock/core-js/issues/1154), [#1155](https://github.com/zloirock/core-js/issues/1155), thanks [@trosos](https://github.com/trosos)
- Added `set(Timeout|Interval|Immediate)` extra arguments fix for Bun 0.3.0- (similarly to IE9-), [bun/1633](https://github.com/oven-sh/bun/issues/1633)
Expand Down
5 changes: 4 additions & 1 deletion packages/core-js/modules/esnext.map.group-by.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
var $ = require('../internals/export');
var call = require('../internals/function-call');
var uncurryThis = require('../internals/function-uncurry-this');
var isCallable = require('../internals/is-callable');
var aCallable = require('../internals/a-callable');
var iterate = require('../internals/iterate');
var Map = require('../internals/map-helpers').Map;

var push = uncurryThis([].push);

// `Map.groupBy` method
// https://github.com/tc39/proposal-collection-methods
$({ target: 'Map', stat: true, forced: true }, {
groupBy: function groupBy(iterable, keyDerivative) {
var newMap = new this();
var C = isCallable(this) ? this : Map;
var newMap = new C();
aCallable(keyDerivative);
var has = aCallable(newMap.has);
var get = aCallable(newMap.get);
Expand Down
5 changes: 4 additions & 1 deletion packages/core-js/modules/esnext.map.key-by.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
var $ = require('../internals/export');
var call = require('../internals/function-call');
var iterate = require('../internals/iterate');
var isCallable = require('../internals/is-callable');
var aCallable = require('../internals/a-callable');
var Map = require('../internals/map-helpers').Map;

// `Map.keyBy` method
// https://github.com/tc39/proposal-collection-methods
$({ target: 'Map', stat: true, forced: true }, {
keyBy: function keyBy(iterable, keyDerivative) {
var newMap = new this();
var C = isCallable(this) ? this : Map;
var newMap = new C();
aCallable(keyDerivative);
var setter = aCallable(newMap.set);
iterate(iterable, function (element) {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit-global/esnext.map.group-by.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ QUnit.test('Map.groupBy', assert => {
const element = {};
Map.groupBy([element], it => assert.same(it, element));

assert.throws(() => groupBy([1, 2], it => it));
// assert.throws(() => groupBy([1, 2], it => it));
});
2 changes: 1 addition & 1 deletion tests/unit-global/esnext.map.key-by.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ QUnit.test('Map.keyBy', assert => {
const element = {};
Map.keyBy([element], it => assert.same(it, element));

assert.throws(() => keyBy([1, 2], it => it));
// assert.throws(() => keyBy([1, 2], it => it));
});
2 changes: 1 addition & 1 deletion tests/unit-pure/esnext.map.group-by.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ QUnit.test('Map.groupBy', assert => {
const element = {};
Map.groupBy([element], it => assert.same(it, element));

assert.throws(() => groupBy([1, 2], it => it));
// assert.throws(() => groupBy([1, 2], it => it));
});
2 changes: 1 addition & 1 deletion tests/unit-pure/esnext.map.key-by.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ QUnit.test('Map.keyBy', assert => {
const element = {};
Map.keyBy([element], it => assert.same(it, element));

assert.throws(() => keyBy([1, 2], it => it));
// assert.throws(() => keyBy([1, 2], it => it));
});

0 comments on commit 68c9bf6

Please sign in to comment.