function convertArray( array, type ) {

	if ( ! array || array.constructor === type ) return array;

	if ( typeof type.BYTES_PER_ELEMENT === 'number' ) {

		return new type( array ); // create typed array

	}

	return Array.prototype.slice.call( array ); // create Array

}
Converts an array to a specific type.

@param {TypedArray|Array} array - The array to convert.
@param {TypedArray.constructor} type - The constructor of a typed array that defines the new type.
@return {TypedArray} The converted array.