index.js
function typeis (value, types_) {
  var i
  var types = types_

  // remove parameters and normalize
  var val = tryNormalizeType(value)

  // no type or invalid
  if (!val) {
    return false
  }

  // support flattened arguments
  if (types && !Array.isArray(types)) {
    types = new Array(arguments.length - 1)
    for (i = 0; i < types.length; i++) {
      types[i] = arguments[i + 1]
    }
  }

  // no types, return the content type
  if (!types || !types.length) {
    return val
  }

  var type
  for (i = 0; i < types.length; i++) {
    if (mimeMatch(normalize(type = types[i]), val)) {
      return type[0] === '+' || type.indexOf('*') !== -1
        ? val
        : type
    }
  }

  // no matches
  return false
}
function typeis (value, types_) {
  var i
  var types = types_

  // remove parameters and normalize
  var val = tryNormalizeType(value)

  // no type or invalid
  if (!val) {
    return false
  }

  // support flattened arguments
  if (types && !Array.isArray(types)) {
    types = new Array(arguments.length - 1)
    for (i = 0; i < types.length; i++) {
      types[i] = arguments[i + 1]
    }
  }

  // no types, return the content type
  if (!types || !types.length) {
    return val
  }

  var type
  for (i = 0; i < types.length; i++) {
    if (mimeMatch(normalize(type = types[i]), val)) {
      return type[0] === '+' || type.indexOf('*') !== -1
        ? val
        : type
    }
  }

  // no matches
  return false
}
function typeis ( value , types_ ) { var i var types = types_ // remove parameters and normalize var val = tryNormalizeType ( value ) // no type or invalid if ( ! val ) { return false } // support flattened arguments if ( types && ! Array . isArray ( types ) ) { types = new Array ( arguments . length - 1 ) for ( i = 0 ; i < types . length ; i ++ ) { types [ i ] = arguments [ i + 1 ] } } // no types, return the content type if ( ! types || ! types . length ) { return val } var type for ( i = 0 ; i < types . length ; i ++ ) { if ( mimeMatch ( normalize ( type = types [ i ] ) , val ) ) { return type [ 0 ] === '+' || type . indexOf ( '*' ) !== - 1 ? val : type } } // no matches return false }
Compare a `value` content-type with `types`.
Each `type` can be an extension like `html`,
a special shortcut like `multipart` or `urlencoded`,
or a mime type.

If no types match, `false` is returned.
Otherwise, the first `type` that matches is returned.

@param {String} value
@param {Array} types
@public
Compare a value content - type with types . Each type can be an extension like html a special shortcut like multipart or urlencoded or a mime type .