encoder.js
function getTypedArrayType( v ) {
	if (v instanceof Float32Array) {
		return NUMTYPE.FLOAT32;
	} else if (v instanceof Float64Array) {
		return NUMTYPE.FLOAT64;
	} else if (v instanceof Uint8Array) {
		return NUMTYPE.UINT8;
	} else if (v instanceof Int8Array) {
		return NUMTYPE.INT8;
	} else if (v instanceof Uint16Array) {
		return NUMTYPE.UINT16;
	} else if (v instanceof Int16Array) {
		return NUMTYPE.INT16;
	} else if (v instanceof Uint32Array) {
		return NUMTYPE.UINT32;
	} else if (v instanceof Int32Array) {
		return NUMTYPE.INT32;
	} else if (v instanceof Array) {

		// Sneaky but fast way to check if array is 100% numeric
		// by testing the first, last and middle elemnet

		var a=0,b=v.length-1,c=Math.floor((b-a)/2);
		if((typeof v[a] === "number") &&
		   (typeof v[b] === "number") &&
		   (typeof v[c] === "number")) {
		   	return NUMTYPE.NUMERIC;
		} else {
			return NUMTYPE.UNKNOWN;
		}

	} else {
		return NUMTYPE.UNKNOWN;
	}
}
function getTypedArrayType( v ) {
	if (v instanceof Float32Array) {
		return NUMTYPE.FLOAT32;
	} else if (v instanceof Float64Array) {
		return NUMTYPE.FLOAT64;
	} else if (v instanceof Uint8Array) {
		return NUMTYPE.UINT8;
	} else if (v instanceof Int8Array) {
		return NUMTYPE.INT8;
	} else if (v instanceof Uint16Array) {
		return NUMTYPE.UINT16;
	} else if (v instanceof Int16Array) {
		return NUMTYPE.INT16;
	} else if (v instanceof Uint32Array) {
		return NUMTYPE.UINT32;
	} else if (v instanceof Int32Array) {
		return NUMTYPE.INT32;
	} else if (v instanceof Array) {

		// Sneaky but fast way to check if array is 100% numeric
		// by testing the first, last and middle elemnet

		var a=0,b=v.length-1,c=Math.floor((b-a)/2);
		if((typeof v[a] === "number") &&
		   (typeof v[b] === "number") &&
		   (typeof v[c] === "number")) {
		   	return NUMTYPE.NUMERIC;
		} else {
			return NUMTYPE.UNKNOWN;
		}

	} else {
		return NUMTYPE.UNKNOWN;
	}
}
function getTypedArrayType ( v ) { if ( v instanceof Float32Array ) { return NUMTYPE . FLOAT32 ; } else if ( v instanceof Float64Array ) { return NUMTYPE . FLOAT64 ; } else if ( v instanceof Uint8Array ) { return NUMTYPE . UINT8 ; } else if ( v instanceof Int8Array ) { return NUMTYPE . INT8 ; } else if ( v instanceof Uint16Array ) { return NUMTYPE . UINT16 ; } else if ( v instanceof Int16Array ) { return NUMTYPE . INT16 ; } else if ( v instanceof Uint32Array ) { return NUMTYPE . UINT32 ; } else if ( v instanceof Int32Array ) { return NUMTYPE . INT32 ; } else if ( v instanceof Array ) { // Sneaky but fast way to check if array is 100% numeric // by testing the first, last and middle elemnet var a = 0 , b = v . length - 1 , c = Math . floor ( ( b - a ) / 2 ) ; if ( ( typeof v [ a ] === "number" ) && ( typeof v [ b ] === "number" ) && ( typeof v [ c ] === "number" ) ) { return NUMTYPE . NUMERIC ; } else { return NUMTYPE . UNKNOWN ; } } else { return NUMTYPE . UNKNOWN ; } }
Get the numerical type of a typed array

@param {array} v - The TypedArray to check
@returns {int} - Returns the NUMTYPE type for the specified array or NUMTYPE.UNKNOWN if not a TypedArray
Get the numerical type of a typed array