encoder.js
function convertArray( array, numType ) {

	// Skip matching cases
	if ( ((array instanceof Uint8Array) && (numType === NUMTYPE.UINT8)) ||
		 ((array instanceof Int8Array) && (numType === NUMTYPE.INT8)) ||
		 ((array instanceof Uint16Array) && (numType === NUMTYPE.UINT16)) ||
		 ((array instanceof Int16Array) && (numType === NUMTYPE.INT16)) ||
		 ((array instanceof Uint32Array) && (numType === NUMTYPE.UINT32)) ||
		 ((array instanceof Int32Array) && (numType === NUMTYPE.INT32)) ||
		 ((array instanceof Float32Array) && (numType === NUMTYPE.FLOAT32)) ||
		 ((array instanceof Float64Array) && (numType === NUMTYPE.FLOAT64)) ) {

		// Return as-is
		return array;
	}

	// Convert
	return new NUMTYPE_CLASS[numType]( array );
}
function convertArray( array, numType ) {

	// Skip matching cases
	if ( ((array instanceof Uint8Array) && (numType === NUMTYPE.UINT8)) ||
		 ((array instanceof Int8Array) && (numType === NUMTYPE.INT8)) ||
		 ((array instanceof Uint16Array) && (numType === NUMTYPE.UINT16)) ||
		 ((array instanceof Int16Array) && (numType === NUMTYPE.INT16)) ||
		 ((array instanceof Uint32Array) && (numType === NUMTYPE.UINT32)) ||
		 ((array instanceof Int32Array) && (numType === NUMTYPE.INT32)) ||
		 ((array instanceof Float32Array) && (numType === NUMTYPE.FLOAT32)) ||
		 ((array instanceof Float64Array) && (numType === NUMTYPE.FLOAT64)) ) {

		// Return as-is
		return array;
	}

	// Convert
	return new NUMTYPE_CLASS[numType]( array );
}
function convertArray ( array , numType ) { // Skip matching cases if ( ( ( array instanceof Uint8Array ) && ( numType === NUMTYPE . UINT8 ) ) || ( ( array instanceof Int8Array ) && ( numType === NUMTYPE . INT8 ) ) || ( ( array instanceof Uint16Array ) && ( numType === NUMTYPE . UINT16 ) ) || ( ( array instanceof Int16Array ) && ( numType === NUMTYPE . INT16 ) ) || ( ( array instanceof Uint32Array ) && ( numType === NUMTYPE . UINT32 ) ) || ( ( array instanceof Int32Array ) && ( numType === NUMTYPE . INT32 ) ) || ( ( array instanceof Float32Array ) && ( numType === NUMTYPE . FLOAT32 ) ) || ( ( array instanceof Float64Array ) && ( numType === NUMTYPE . FLOAT64 ) ) ) { // Return as-is return array ; } // Convert return new NUMTYPE_CLASS [ numType ] ( array ) ; }
Convert input array to the type specified

@param {array} array - The source array
@param {int} downscale_type - The downscaling conversion
Convert input array to the type specified