Skip to content

Commit

Permalink
disable forced replacement for methods from "Change Array by copy" …
Browse files Browse the repository at this point in the history
…proposal
  • Loading branch information
zloirock committed Apr 12, 2022
1 parent a7aab7f commit eff765f
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
##### Unreleased
- [Change `Array` by copy proposal](https://github.com/tc39/proposal-change-array-by-copy):
- Moved to Stage 3, [March TC39 meeting](https://github.com/babel/proposals/issues/81#issuecomment-1083449843)
- Disabled forced replacement and added `/actual/` entry points for methods from this proposal
- `Array.prototype.toSpliced` throws a `TypeError` instead of `RangeError` if the result length is more than `MAX_SAFE_INTEGER`, [proposal-change-array-by-copy/70](https://github.com/tc39/proposal-change-array-by-copy/pull/70)
- Added some more `atob` / `btoa` fixes:
- NodeJS <17.9 `atob` does not ignore spaces, [node/42530](https://github.com/nodejs/node/issues/42530)
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.array.to-reversed.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var Array = global.Array;

// `Array.prototype.toReversed` method
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed
$({ target: 'Array', proto: true, forced: true }, {
$({ target: 'Array', proto: true }, {
toReversed: function toReversed() {
return arrayToReversed(toIndexedObject(this), Array);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.array.to-sorted.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var sort = uncurryThis(getVirtual('Array').sort);

// `Array.prototype.toSorted` method
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSorted
$({ target: 'Array', proto: true, forced: true }, {
$({ target: 'Array', proto: true }, {
toSorted: function toSorted(compareFn) {
if (compareFn !== undefined) aCallable(compareFn);
var O = toIndexedObject(this);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.array.to-spliced.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var Array = global.Array;

// `Array.prototype.toSpliced` method
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSpliced
$({ target: 'Array', proto: true, forced: true }, {
$({ target: 'Array', proto: true }, {
// eslint-disable-next-line no-unused-vars -- required for .length
toSpliced: function toSpliced(start, deleteCount /* , ...items */) {
return arrayToSpliced(toIndexedObject(this), Array, arraySlice(arguments));
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.array.with.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var Array = global.Array;

// `Array.prototype.with` method
// https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.with
$({ target: 'Array', proto: true, forced: true }, {
$({ target: 'Array', proto: true }, {
'with': function (index, value) {
return arrayWith(toIndexedObject(this), Array, index, value);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.typed-array.to-reversed.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
// https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toReversed
exportTypedArrayMethod('toReversed', function toReversed() {
return arrayToReversed(aTypedArray(this), this[TYPED_ARRAY_CONSTRUCTOR]);
}, true);
});
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.typed-array.to-sorted.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ exportTypedArrayMethod('toSorted', function toSorted(compareFn) {
var O = aTypedArray(this);
var A = arrayFromConstructorAndList(O[TYPED_ARRAY_CONSTRUCTOR], O);
return sort(A, compareFn);
}, true);
});
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.typed-array.to-spliced.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
// eslint-disable-next-line no-unused-vars -- required for .length
exportTypedArrayMethod('toSpliced', function toSpliced(start, deleteCount /* , ...items */) {
return arrayToSpliced(aTypedArray(this), this[TYPED_ARRAY_CONSTRUCTOR], arraySlice(arguments));
}, true);
});
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.typed-array.with.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
// https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.with
exportTypedArrayMethod('with', { 'with': function (index, value) {
return arrayWith(aTypedArray(this), this[TYPED_ARRAY_CONSTRUCTOR], index, value);
} }['with'], true);
} }['with']);

0 comments on commit eff765f

Please sign in to comment.