/** * * @desc Splits an array into smaller arrays. * Number of elements in one small chunk is given by `part` * * @param {Number[]} array - The array to split into chunks * @param {Number} part - elements in one chunk * * @returns {Number[]} An array of smaller chunks */ splitArray(array, part) { const result = []; for (let i = 0; i < array.length; i += part) { result.push(new array.constructor(array.buffer, i * 4 + array.byteOffset, part)); } return result; }
|| typedArray instanceof Float64Array ) { typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);