Skip to content

Commit

Permalink
drop unneeded non-standard %TypedArray%.prototype.toSpliced feature…
Browse files Browse the repository at this point in the history
… detection
  • Loading branch information
zloirock committed Nov 21, 2024
1 parent f37b548 commit ebf97cc
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions packages/core-js/modules/esnext.typed-array.to-spliced.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,13 @@ var isBigIntArray = require('../internals/is-big-int-array');
var toAbsoluteIndex = require('../internals/to-absolute-index');
var toBigInt = require('../internals/to-big-int');
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
var fails = require('../internals/fails');

var aTypedArray = ArrayBufferViewCore.aTypedArray;
var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
var max = Math.max;
var min = Math.min;

// some early implementations, like WebKit, does not follow the final semantic
var PROPER_ORDER = !fails(function () {
// eslint-disable-next-line es/no-typed-arrays -- required for testing
var array = new Int8Array([1]);

var spliced = array.toSpliced(1, 0, {
valueOf: function () {
array[0] = 2;
return 3;
}
});

return spliced[0] !== 2 || spliced[1] !== 3;
});

// `%TypedArray%.prototype.toSpliced` method
// https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSpliced
exportTypedArrayMethod('toSpliced', function toSpliced(start, deleteCount /* , ...items */) {
Expand Down Expand Up @@ -65,4 +49,4 @@ exportTypedArrayMethod('toSpliced', function toSpliced(start, deleteCount /* , .
for (; k < newLen; k++) A[k] = O[k + actualDeleteCount - insertCount];

return A;
}, !PROPER_ORDER);
}, true);

0 comments on commit ebf97cc

Please sign in to comment.