{
  "name": "type-is",
  "description": "Infer the content-type of a request.",
  "version": "1.5.7",
  "author": {
    "name": "Jonathan Ong",
    "email": "me@jongleberry.com",
    "url": "http://jongleberry.com"
  },
  "contributors": [
    {
      "name": "Douglas Christopher Wilson",
      "email": "doug@somethingdoug.com"
    }
  ],
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "git://github.com/jshttp/type-is"
  },
  "dependencies": {
    "media-typer": "0.3.0",
    "mime-types": "~2.0.9"
  },
  "devDependencies": {
    "istanbul": "0.3.5",
    "mocha": "~1.21.5"
  },
  "engines": {
    "node": ">= 0.6"
  },
  "files": [
    "LICENSE",
    "HISTORY.md",
    "index.js"
  ],
  "scripts": {
    "test": "mocha --reporter spec --check-leaks --bail test/",
    "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
    "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
  },
  "keywords": [
    "content",
    "type",
    "checking"
  ],
  "readme": "# type-is\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Node.js Version][node-version-image]][node-version-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nInfer the content-type of a request.\n\n### Install\n\n```sh\n$ npm install type-is\n```\n\n## API\n\n```js\nvar http = require('http')\nvar is   = require('type-is')\n\nhttp.createServer(function (req, res) {\n  var istext = is(req, ['text/*'])\n  res.end('you ' + (istext ? 'sent' : 'did not send') + ' me text')\n})\n```\n\n### type = is(request, types)\n\n`request` is the node HTTP request. `types` is an array of types.\n\n```js\n// req.headers.content-type = 'application/json'\n\nis(req, ['json'])             // 'json'\nis(req, ['html', 'json'])     // 'json'\nis(req, ['application/*'])    // 'application/json'\nis(req, ['application/json']) // 'application/json'\n\nis(req, ['html']) // false\n```\n\n### type = is.is(mediaType, types)\n\n`mediaType` is the [media type](https://tools.ietf.org/html/rfc6838) string. `types` is an array of types.\n\n```js\nvar mediaType = 'application/json'\n\nis.is(mediaType, ['json'])             // 'json'\nis.is(mediaType, ['html', 'json'])     // 'json'\nis.is(mediaType, ['application/*'])    // 'application/json'\nis.is(mediaType, ['application/json']) // 'application/json'\n\nis.is(mediaType, ['html']) // false\n```\n\n### Each type can be:\n\n- An extension name such as `json`. This name will be returned if matched.\n- A mime type such as `application/json`.\n- A mime type with a wildcard such as `*/json` or `application/*`. The full mime type will be returned if matched\n- A suffix such as `+json`. This can be combined with a wildcard such as `*/vnd+json` or `application/*+json`. The full mime type will be returned if matched.\n\n`false` will be returned if no type matches.\n\n`null` will be returned if the request does not have a body.\n\n## Examples\n\n#### Example body parser\n\n```js\nvar is = require('type-is');\n\nfunction bodyParser(req, res, next) {\n  if (!is.hasBody(req)) {\n    return next()\n  }\n\n  switch (is(req, ['urlencoded', 'json', 'multipart'])) {\n    case 'urlencoded':\n      // parse urlencoded body\n      throw new Error('implement urlencoded body parsing')\n      break\n    case 'json':\n      // parse json body\n      throw new Error('implement json body parsing')\n      break\n    case 'multipart':\n      // parse multipart body\n      throw new Error('implement multipart body parsing')\n      break\n    default:\n      // 415 error code\n      res.statusCode = 415\n      res.end()\n      return\n  }\n}\n```\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/type-is.svg?style=flat\n[npm-url]: https://npmjs.org/package/type-is\n[node-version-image]: https://img.shields.io/node/v/type-is.svg?style=flat\n[node-version-url]: http://nodejs.org/download/\n[travis-image]: https://img.shields.io/travis/jshttp/type-is.svg?style=flat\n[travis-url]: https://travis-ci.org/jshttp/type-is\n[coveralls-image]: https://img.shields.io/coveralls/jshttp/type-is.svg?style=flat\n[coveralls-url]: https://coveralls.io/r/jshttp/type-is?branch=master\n[downloads-image]: https://img.shields.io/npm/dm/type-is.svg?style=flat\n[downloads-url]: https://npmjs.org/package/type-is\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/jshttp/type-is/issues"
  },
  "homepage": "https://github.com/jshttp/type-is",
  "_id": "type-is@1.5.7",
  "dist": {
    "shasum": "89d0d4a7322ab976cdac63423e1c9d6cf905cfef"
  },
  "_from": "type-is@~1.5.2",
  "_resolved": "https://registry.npmjs.org/type-is/-/type-is-1.5.7.tgz"
}
