index.js
function normalize (obj) {
	if (!obj.dtype) {
		obj.dtype = defaultDtype[obj.type] || 'array'
	}

	//provide limits
	switch (obj.dtype) {
		case 'float32':
		case 'float64':
		case 'audiobuffer':
		case 'ndsamples':
		case 'ndarray':
			obj.min = -1
			obj.max = 1
			break;
		case 'uint8':
			obj.min = 0
			obj.max = 255
			break;
		case 'uint16':
			obj.min = 0
			obj.max = 65535
			break;
		case 'uint32':
			obj.min = 0
			obj.max = 4294967295
			break;
		case 'int8':
			obj.min = -128
			obj.max = 127
			break;
		case 'int16':
			obj.min = -32768
			obj.max = 32767
			break;
		case 'int32':
			obj.min = -2147483648
			obj.max = 2147483647
			break;
		default:
			obj.min = -1
			obj.max = 1
			break;
	}

	return obj
}
function normalize (obj) {
	if (!obj.dtype) {
		obj.dtype = defaultDtype[obj.type] || 'array'
	}

	//provide limits
	switch (obj.dtype) {
		case 'float32':
		case 'float64':
		case 'audiobuffer':
		case 'ndsamples':
		case 'ndarray':
			obj.min = -1
			obj.max = 1
			break;
		case 'uint8':
			obj.min = 0
			obj.max = 255
			break;
		case 'uint16':
			obj.min = 0
			obj.max = 65535
			break;
		case 'uint32':
			obj.min = 0
			obj.max = 4294967295
			break;
		case 'int8':
			obj.min = -128
			obj.max = 127
			break;
		case 'int16':
			obj.min = -32768
			obj.max = 32767
			break;
		case 'int32':
			obj.min = -2147483648
			obj.max = 2147483647
			break;
		default:
			obj.min = -1
			obj.max = 1
			break;
	}

	return obj
}
function normalize ( obj ) { if ( ! obj . dtype ) { obj . dtype = defaultDtype [ obj . type ] || 'array' } //provide limits switch ( obj . dtype ) { case 'float32' : case 'float64' : case 'audiobuffer' : case 'ndsamples' : case 'ndarray' : obj . min = - 1 obj . max = 1 break ; case 'uint8' : obj . min = 0 obj . max = 255 break ; case 'uint16' : obj . min = 0 obj . max = 65535 break ; case 'uint32' : obj . min = 0 obj . max = 4294967295 break ; case 'int8' : obj . min = - 128 obj . max = 127 break ; case 'int16' : obj . min = - 32768 obj . max = 32767 break ; case 'int32' : obj . min = - 2147483648 obj . max = 2147483647 break ; default : obj . min = - 1 obj . max = 1 break ; } return obj }
make sure all format properties are present
make sure all format properties are present