Assert typeof.

@param {Mixed} type
@param {String} description
@api public
184700
function(type, desc){
        this.assert(
            type == typeof this.obj
            , function(){ return 'expected ' + this.inspect + ' to be a ' + type + (desc ? " | " + desc : "") }
            , function(){ return 'expected ' + this.inspect + ' not to be a ' + type  + (desc ? " | " + desc : "") })
        return this;
    }
247617
def assertType(var, *allowedTypes):
    
    if not isinstance(var, *allowedTypes):
        raise NotImplementedError("This operation is only supported for {}. "\
            "Instead found {}".format(str(*allowedTypes), type(var)))
1163629
function(type){
            type = this.string(type);
            if(types.indexOf(type.toLowerCase()) < 0){
                throw new TypeError('a type in [' + types.join(', ') + '] is expected, but ' + type + ' given');
            }
            return type.toLowerCase();
        }
810640
function isType(type, val) {
  if (Struct.typeChecker[type]) {
    return Struct.typeChecker[type](val);
  }
  return false;
}
427292
function isType(type, string) {
    if (isString(string) || isNumber(string)) {
        if (_regex.regex[type] && type !== 'default') {
            string = String(string);
            return _regex.regex[type].test(string);
        } else {
            throw Error('unknown type ' + type);
        }
    } else {
        throw Error('type should be string or number');
    }
}
1278049
function checkType(type, value, errors) {
	if (type) {
		var actualType = typeof value;

		if (typeof type == 'string') {
			type = type.toLowerCase();
			switch(type) {
				case 'any':
					return [];
				case 'array':
					if (!Array.isArray(value)) {
						return [{
							property: path,
							message: 'expected an array, but ' + actualType + ' found instead'
						}];
					}
					break;
				case 'integer':
				case 'int':
					type = 'integer';
					break;
				case 'float':
				case 'double':
				case 'number':
					type = 'number';
					// fall through
				default:
					if (actualType != type) {
						return [{
							property: path,
							message: 'expected ' + type + ', but ' + actualType + ' found instead'
						}];
					}
					break;
			}
			return [];
		}

		if (Array.isArray(type)) {
			var unionErrors = [];
			for(var j = 0; j < type.length; j++) { // a union type
				var errs = checkType(type[j], value, errors);
				if (!errs.length) { return []; }
				unionErrors = unionErrors.concat(errs);
			}
			return unionErrors;
		} else if (typeof type == 'object') {
			return checkProp(value, type, path);
		}
	}

	return [];
}
330174
function validate (type, value) {
  const { t } = readType(type)
  if (value === undefined || value === null) return { require: true }

  switch (t) {
    case SOPHIA_TYPES.int:
      return isNaN(value) || ['boolean'].includes(typeof value)
    case SOPHIA_TYPES.bool:
      return typeof value !== 'boolean'
    case SOPHIA_TYPES.address:
      return !(value[2] === '_' && ['ak', 'ct'].includes(value.slice(0, 2)))
    default:
      return false
  }
}
106889
function _typeof (commentStr) {
    for (var key in commentRegex) {
        var regex = commentRegex[key][0];
        if (regex.test(commentStr)) return key;
    }
    return '';
}
729804
public static String getDescription(TypeDeclaration type) {
		if (type == null || type.description() == null) {
			return null;
		} else {
			return type.description().value();
		}
	}
26602
function(type) {
    if (typeof XMLHttpRequest == 'undefined') {
      return false;
    }
    var xhr = new XMLHttpRequest();
    xhr.open('get', '/', true);
    try {
      xhr.responseType = type;
    } catch(error) {
      return false;
    }
    return 'response' in xhr && xhr.responseType == type;
  }
1165775
function typeOf (value) {
  if (value === null) return 'null'
  var valueType = typeof value
  if (valueType === 'object') {
    valueType = value.constructor.name.toLowerCase()
  }
  return valueType
}
1000430
function checkType(type,value){
             if(type){
                 if(typeof type == 'string' && type != 'any' &&
                         (type == 'null' ? value !== null : typeof value != type) &&
                         !(value instanceof Array && type == 'array') &&
                         !(value instanceof Date && type == 'date') &&
                         !(type == 'integer' && value%1===0)){
                     return [{property:path,message:(typeof value) + " value found, but a " + type + " is required"}];
                 }
                 if(type instanceof Array){
                     var unionErrors=[];
                     for(var j = 0; j < type.length; j++){ // a union type
                         if(!(unionErrors=checkType(type[j],value)).length){
                             break;
                         }
                     }
                     if(unionErrors.length){
                         return unionErrors;
                     }
                 }else if(typeof type == 'object'){
                     var priorErrors = errors;
                     errors = [];
                     checkProp(value,type,path);
                     var theseErrors = errors;
                     errors = priorErrors;
                     return theseErrors;
                 }
             }
             return [];
         }
903538
public function setType(?string $type, string $description = null) {
		$this->type = $type;
		if (null !== $description) {
			$this->setTypeDescription($description);
		}

		return $this;
	}
341261
function (description, errdesc) {

        //TODO: errdesc is a bit vague
        var desc = {
            description : description
        };
        if (errdesc) {
            if (errdesc.line) { // Integers
                desc.line = errdesc.line;
                desc.column = errdesc.column;
            }
            if (errdesc.code) { // String
                desc.code = errdesc.code;
            }
            if (errdesc.suberrors) { // Array of String
                desc.suberrors = errdesc.suberrors;
            }
        }
        this.errors.push(desc);
    }
211028
function getType (str, typeLinks) {
  if (str in typeLinks) {
    return dom.create('a').class('qm-api-type-link').attr('href', typeLinks[str]).text(str)
  } else {
    return str
  }
}
995689
function typeOf(value, options) {
            if (value === undefined) return '#Undefined';
            if (value === null) return '#Null';
            if (options !== 'forceObjectToString') {
                var constructor = getConstructor(value);
                if (constructor !== null) {
                    var type = getFunctionName(constructor);
                    if (type === 'Object') {
                        return getObjectToStringValue(value);
                    }
                    return (type === 'Number' && value != +value) ? '#NaN' : type;
                }
            }
            return getObjectToStringValue(value);
        }
1327559
function (type, fn) {
  var result;
  try {
    result = fn();
  }
  catch (e) {
    result = {error: e};
  }

  if (result && !result.type && type)
    result.type = type;

  return result;
}