libs/commandio.js
function checkDescriptor(descriptor, err){
	if(typeof descriptor != 'object') return false;
	
	for(var key in CONST.descriptorType){
		if(!checkType(descriptor[key], CONST.descriptorType[key])){
			err.key = key;
			err.expect = CONST.descriptorType[key];
			err.type = typeof descriptor[key];
			return false;
		}
	}

	for(var key in CONST.descriptorOptType){
		if(typeof descriptor[key] != 'undefined' && checkType(descriptor[key], CONST.descriptorOptType[key].type)) continue;
		if(typeof descriptor[key] == 'undefined'){
			if(typeof CONST.descriptorOptType[key].value != 'undefined') descriptor[key] = CONST.descriptorOptType[key].value;
			continue;
		}

		err.key = key;
		err.expect = CONST.descriptorOptType[key].type;
		err.type = typeof descriptor[key];
		return false;
	}

	return true;
}
function checkDescriptor(descriptor, err){
	if(typeof descriptor != 'object') return false;
	
	for(var key in CONST.descriptorType){
		if(!checkType(descriptor[key], CONST.descriptorType[key])){
			err.key = key;
			err.expect = CONST.descriptorType[key];
			err.type = typeof descriptor[key];
			return false;
		}
	}

	for(var key in CONST.descriptorOptType){
		if(typeof descriptor[key] != 'undefined' && checkType(descriptor[key], CONST.descriptorOptType[key].type)) continue;
		if(typeof descriptor[key] == 'undefined'){
			if(typeof CONST.descriptorOptType[key].value != 'undefined') descriptor[key] = CONST.descriptorOptType[key].value;
			continue;
		}

		err.key = key;
		err.expect = CONST.descriptorOptType[key].type;
		err.type = typeof descriptor[key];
		return false;
	}

	return true;
}
function checkDescriptor ( descriptor , err ) { if ( typeof descriptor != 'object' ) return false ; for ( var key in CONST . descriptorType ) { if ( ! checkType ( descriptor [ key ] , CONST . descriptorType [ key ] ) ) { err . key = key ; err . expect = CONST . descriptorType [ key ] ; err . type = typeof descriptor [ key ] ; return false ; } } for ( var key in CONST . descriptorOptType ) { if ( typeof descriptor [ key ] != 'undefined' && checkType ( descriptor [ key ] , CONST . descriptorOptType [ key ] . type ) ) continue ; if ( typeof descriptor [ key ] == 'undefined' ) { if ( typeof CONST . descriptorOptType [ key ] . value != 'undefined' ) descriptor [ key ] = CONST . descriptorOptType [ key ] . value ; continue ; } err . key = key ; err . expect = CONST . descriptorOptType [ key ] . type ; err . type = typeof descriptor [ key ] ; return false ; } return true ; }
Check if the command descriptor is valid.
@return boolean
Check if the command descriptor is valid .