{ "_args": [ [ { "raw": "accepts@~1.3.4", "scope": null, "escapedName": "accepts", "name": "accepts", "rawSpec": "~1.3.4", "spec": ">=1.3.4 <1.4.0", "type": "range" }, "/home/jdaugherty/work/GT2/GT2-Android/node_modules/express" ] ], "_from": "accepts@>=1.3.4 <1.4.0", "_id": "accepts@1.3.4", "_inCache": true, "_location": "/accepts", "_nodeVersion": "6.11.1", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/accepts-1.3.4.tgz_1503455053008_0.43370609171688557" }, "_npmUser": { "name": "dougwilson", "email": "doug@somethingdoug.com" }, "_npmVersion": "3.10.10", "_phantomChildren": {}, "_requested": { "raw": "accepts@~1.3.4", "scope": null, "escapedName": "accepts", "name": "accepts", "rawSpec": "~1.3.4", "spec": ">=1.3.4 <1.4.0", "type": "range" }, "_requiredBy": [ "/express" ], "_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz", "_shasum": "86246758c7dd6d21a6474ff084a4740ec05eb21f", "_shrinkwrap": null, "_spec": "accepts@~1.3.4", "_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/express", "bugs": { "url": "https://github.com/jshttp/accepts/issues" }, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" }, { "name": "Jonathan Ong", "email": "me@jongleberry.com", "url": "http://jongleberry.com" } ], "dependencies": { "mime-types": "~2.1.16", "negotiator": "0.6.1" }, "description": "Higher-level content negotiation", "devDependencies": { "eslint": "3.19.0", "eslint-config-standard": "10.2.1", "eslint-plugin-import": "2.7.0", "eslint-plugin-markdown": "1.0.0-beta.6", "eslint-plugin-node": "5.1.1", "eslint-plugin-promise": "3.5.0", "eslint-plugin-standard": "3.0.1", "istanbul": "0.4.5", "mocha": "~1.21.5" }, "directories": {}, "dist": { "shasum": "86246758c7dd6d21a6474ff084a4740ec05eb21f", "tarball": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz" }, "engines": { "node": ">= 0.6" }, "files": [ "LICENSE", "HISTORY.md", "index.js" ], "gitHead": "71ea430741d6eb5484b6c67c95924540a98186a5", "homepage": "https://github.com/jshttp/accepts#readme", "keywords": [ "content", "negotiation", "accept", "accepts" ], "license": "MIT", "maintainers": [ { "name": "dougwilson", "email": "doug@somethingdoug.com" } ], "name": "accepts", "optionalDependencies": {}, "readme": "# accepts\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\nHigher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).\nExtracted from [koa](https://www.npmjs.com/package/koa) for general use.\n\nIn addition to negotiator, it allows:\n\n- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`\n as well as `('text/html', 'application/json')`.\n- Allows type shorthands such as `json`.\n- Returns `false` when no types match\n- Treats non-existent headers as `*`\n\n## Installation\n\nThis is a [Node.js](https://nodejs.org/en/) module available through the\n[npm registry](https://www.npmjs.com/). Installation is done using the\n[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):\n\n```sh\n$ npm install accepts\n```\n\n## API\n\n\n\n```js\nvar accepts = require('accepts')\n```\n\n### accepts(req)\n\nCreate a new `Accepts` object for the given `req`.\n\n#### .charset(charsets)\n\nReturn the first accepted charset. If nothing in `charsets` is accepted,\nthen `false` is returned.\n\n#### .charsets()\n\nReturn the charsets that the request accepts, in the order of the client's\npreference (most preferred first).\n\n#### .encoding(encodings)\n\nReturn the first accepted encoding. If nothing in `encodings` is accepted,\nthen `false` is returned.\n\n#### .encodings()\n\nReturn the encodings that the request accepts, in the order of the client's\npreference (most preferred first).\n\n#### .language(languages)\n\nReturn the first accepted language. If nothing in `languages` is accepted,\nthen `false` is returned.\n\n#### .languages()\n\nReturn the languages that the request accepts, in the order of the client's\npreference (most preferred first).\n\n#### .type(types)\n\nReturn the first accepted type (and it is returned as the same text as what\nappears in the `types` array). If nothing in `types` is accepted, then `false`\nis returned.\n\nThe `types` array can contain full MIME types or file extensions. Any value\nthat is not a full MIME types is passed to `require('mime-types').lookup`.\n\n#### .types()\n\nReturn the types that the request accepts, in the order of the client's\npreference (most preferred first).\n\n## Examples\n\n### Simple type negotiation\n\nThis simple example shows how to use `accepts` to return a different typed\nrespond body based on what the client wants to accept. The server lists it's\npreferences in order and will get back the best match between the client and\nserver.\n\n```js\nvar accepts = require('accepts')\nvar http = require('http')\n\nfunction app (req, res) {\n var accept = accepts(req)\n\n // the order of this list is significant; should be server preferred order\n switch (accept.type(['json', 'html'])) {\n case 'json':\n res.setHeader('Content-Type', 'application/json')\n res.write('{\"hello\":\"world!\"}')\n break\n case 'html':\n res.setHeader('Content-Type', 'text/html')\n res.write('hello, world!')\n break\n default:\n // the fallback is text/plain, so no need to specify it above\n res.setHeader('Content-Type', 'text/plain')\n res.write('hello, world!')\n break\n }\n\n res.end()\n}\n\nhttp.createServer(app).listen(3000)\n```\n\nYou can test this out with the cURL program:\n```sh\ncurl -I -H'Accept: text/html' http://localhost:3000/\n```\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/accepts.svg\n[npm-url]: https://npmjs.org/package/accepts\n[node-version-image]: https://img.shields.io/node/v/accepts.svg\n[node-version-url]: https://nodejs.org/en/download/\n[travis-image]: https://img.shields.io/travis/jshttp/accepts/master.svg\n[travis-url]: https://travis-ci.org/jshttp/accepts\n[coveralls-image]: https://img.shields.io/coveralls/jshttp/accepts/master.svg\n[coveralls-url]: https://coveralls.io/r/jshttp/accepts\n[downloads-image]: https://img.shields.io/npm/dm/accepts.svg\n[downloads-url]: https://npmjs.org/package/accepts\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/jshttp/accepts.git" }, "scripts": { "lint": "eslint --plugin markdown --ext js,md .", "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.3.4" }