{
  "_args": [
    [
      "type-is@https://registry.npmjs.org/type-is/-/type-is-1.6.11.tgz",
      "/Users/nw/flint/packages/flint"
    ]
  ],
  "_from": "type-is@>=1.6.1 <1.7.0",
  "_id": "type-is@1.6.11",
  "_inCache": true,
  "_location": "/type-is",
  "_phantomChildren": {},
  "_requested": {
    "name": "type-is",
    "raw": "type-is@https://registry.npmjs.org/type-is/-/type-is-1.6.11.tgz",
    "rawSpec": "https://registry.npmjs.org/type-is/-/type-is-1.6.11.tgz",
    "scope": null,
    "spec": "https://registry.npmjs.org/type-is/-/type-is-1.6.11.tgz",
    "type": "remote"
  },
  "_requiredBy": [
    "/express"
  ],
  "_resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.11.tgz",
  "_shasum": "42ecde7970f2363738b986c0351efba5aa531648",
  "_shrinkwrap": null,
  "_spec": "type-is@https://registry.npmjs.org/type-is/-/type-is-1.6.11.tgz",
  "_where": "/Users/nw/flint/packages/flint",
  "bugs": {
    "url": "https://github.com/jshttp/type-is/issues"
  },
  "contributors": [
    {
      "name": "Douglas Christopher Wilson",
      "email": "doug@somethingdoug.com"
    },
    {
      "name": "Jonathan Ong",
      "email": "me@jongleberry.com",
      "url": "http://jongleberry.com"
    }
  ],
  "dependencies": {
    "media-typer": "0.3.0",
    "mime-types": "~2.1.9"
  },
  "description": "Infer the content-type of a request.",
  "devDependencies": {
    "istanbul": "0.4.2",
    "mocha": "1.21.5"
  },
  "engines": {
    "node": ">= 0.6"
  },
  "files": [
    "HISTORY.md",
    "LICENSE",
    "index.js"
  ],
  "homepage": "https://github.com/jshttp/type-is#readme",
  "keywords": [
    "checking",
    "content",
    "type"
  ],
  "license": "MIT",
  "name": "type-is",
  "optionalDependencies": {},
  "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### is.hasBody(request)\n\nReturns a Boolean if the given `request` has a body, regardless of the\n`Content-Type` header.\n\nHaving a body has no relation to how large the body is (it may be 0 bytes).\nThis is similar to how file existance works. If a body does exist, then this\nindicates that there is data to read from the Node.js request stream.\n\n```js\nif (is.hasBody(req)) {\n  // read the body, since there is one\n\n  req.on('data', function (chunk) {\n    // ...\n  })\n}\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 `*/*` or `*/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 or the content type is invalid.\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\n[npm-url]: https://npmjs.org/package/type-is\n[node-version-image]: https://img.shields.io/node/v/type-is.svg\n[node-version-url]: https://nodejs.org/en/download/\n[travis-image]: https://img.shields.io/travis/jshttp/type-is/master.svg\n[travis-url]: https://travis-ci.org/jshttp/type-is\n[coveralls-image]: https://img.shields.io/coveralls/jshttp/type-is/master.svg\n[coveralls-url]: https://coveralls.io/r/jshttp/type-is?branch=master\n[downloads-image]: https://img.shields.io/npm/dm/type-is.svg\n[downloads-url]: https://npmjs.org/package/type-is\n",
  "readmeFilename": "README.md",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/jshttp/type-is.git"
  },
  "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/"
  },
  "version": "1.6.11"
}
