ColumnUtils.splice does not match Array.splice for typed-array bounds
Expected behaviour
ColumnUtils.splice should apply the same start and delete-count normalization for ordinary arrays and typed-array-backed columns. Negative, fractional, out-of-range, NaN, and infinite arguments should therefore produce equivalent retained and removed values.
Actual behaviour
The typed-array branch passes raw arguments to subarray/slice, subtracts the raw delete count from the new allocation length, and uses the raw start as a TypedArray#set offset. Negative/out-of-range/fractional/non-finite values can remove different elements than Array.splice, throw during allocation/set, or calculate an invalid result length.
Live demo with steps to reproduce
const expected = [1, 2, 3];
const removed = expected.splice(-2, 1, 8);
const actual = ColumnUtils.splice(
new Uint8Array([1, 2, 3]), -2, 1, false, [8]
);
console.log(expected, removed);
console.log(Array.from(actual.array), Array.from(actual.removed));The typed-array path does not match the ordinary-array result and may throw for other valid splice numeric inputs.
Product version
Highcharts master 48b5b3e99a0fa9aae9a357165a5a916f504afeca / 13.0.2
Affected browser(s)
All JavaScript environments using typed-array data columns.
Source: highcharts/highcharts