{"name":"negotiator","description":"HTTP content negotiation","version":"0.6.2","contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"},{"name":"Federico Romero","email":"federico.romero@outboxlabs.com"},{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"}],"license":"MIT","keywords":["http","content negotiation","accept","accept-language","accept-encoding","accept-charset"],"repository":{"type":"git","url":"git+https://github.com/jshttp/negotiator.git"},"devDependencies":{"eslint":"5.16.0","eslint-plugin-markdown":"1.0.0","mocha":"6.1.4","nyc":"14.0.0"},"engines":{"node":">= 0.6"},"scripts":{"lint":"eslint --plugin markdown --ext js,md .","test":"mocha --reporter spec --check-leaks --bail test/","test-cov":"nyc --reporter=html --reporter=text npm test","test-travis":"nyc --reporter=text npm test"},"gitHead":"99f418e11907b60e63f0addc09fc596ddc7be5be","bugs":{"url":"https://github.com/jshttp/negotiator/issues"},"homepage":"https://github.com/jshttp/negotiator#readme","_id":"negotiator@0.6.2","_npmVersion":"6.4.1","_nodeVersion":"8.16.0","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"dist":{"integrity":"sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==","shasum":"feacf7ccf525a77ae9634436a64883ffeca346fb","tarball":"http://registry-npm.ywwl.com/negotiator/download/negotiator-0.6.2.tgz","fileCount":9,"unpackedSize":28102,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcx5cnCRA9TVsSAnZWagAAP20P/0MCkOVbsy3QpadyxP2l\nfQaJNj3676xMnX1jvmbttyR2pejPTOeACkojxti4dkza3VoK5i0P2vxXVjjC\nFTS+joLUaqyS/urJFhQOxICR37l1s849MnXrwV/+mIo7kytMelYJcTbPj3ov\np6OYauZfzPlnFP3zxBYaPmIOKSILILVoVGPSwkRrJlgJUgdqzaMKSUTfTCzq\nELh0wT834veFEnFIeu84Z4NWf6QPrWLwO8Fi6clDpTc0TYJl4xi0cEo9euSB\nQdKVK2gwPCLq6vV3TZoPHCs4/8XLX9zSZLqrAeiK6gC8rrJiGIEFTVLgUXIc\nDb7bKpcOlpvRBBGwtoa0crIGWEFZ5HCTLeDL3ZyfafZ6XqTYeOrYUpvmhv+A\nU6abBAxcE2FGdWkYuSMrbSU1KplzubcLEthVfVilREcQl7V/INK1rRzC/YPb\nlvXd0VqHH+JzsIqe5okX6prnQmKJ6I9Xtu2y7/ocI1WkikaU3bFjbIwke40w\nLTjqvSGCmc9End3k50XOG/AwhitANuOMugJ8iYwn1DwT995tj6IW8Am+C2gR\n0lceIeUnOq5VxtDYN/q2rfVg/cHcr9srAnPdGp4dwcSLTwWX9/vDKB6piasF\nZnYHmofBFT2ensRv1qYU4nlDZPULH5T+rPFVhZgGUCpJzzc2wAMTpFcQixQ3\nCEXq\r\n=qmZ/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCEn6pIqEPZoWJro9Gzw68rWPuY85N+4Gc7pvkkjnWCXwIhANk1pMmmdcSgOm86fubVJG1WksNiqEql5u/a6y8z4ipS"}],"size":6650,"noattachment":false,"key":"/negotiator/-/negotiator-0.6.2.tgz"},"maintainers":[{"email":"doug@somethingdoug.com","name":"dougwilson"},{"email":"jonathanrichardong@gmail.com","name":"jongleberry"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/negotiator_0.6.2_1556584230489_0.2011163414894186"},"_hasShrinkwrap":false,"readme":"# negotiator\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][github-actions-ci-image]][github-actions-ci-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nAn HTTP content negotiator for Node.js\n\n## Installation\n\n```sh\n$ npm install negotiator\n```\n\n## API\n\n```js\nvar Negotiator = require('negotiator')\n```\n\n### Accept Negotiation\n\n```js\navailableMediaTypes = ['text/html', 'text/plain', 'application/json']\n\n// The negotiator constructor receives a request object\nnegotiator = new Negotiator(request)\n\n// Let's say Accept header is 'text/html, application/*;q=0.2, image/jpeg;q=0.8'\n\nnegotiator.mediaTypes()\n// -> ['text/html', 'image/jpeg', 'application/*']\n\nnegotiator.mediaTypes(availableMediaTypes)\n// -> ['text/html', 'application/json']\n\nnegotiator.mediaType(availableMediaTypes)\n// -> 'text/html'\n```\n\nYou can check a working example at `examples/accept.js`.\n\n#### Methods\n\n##### mediaType()\n\nReturns the most preferred media type from the client.\n\n##### mediaType(availableMediaType)\n\nReturns the most preferred media type from a list of available media types.\n\n##### mediaTypes()\n\nReturns an array of preferred media types ordered by the client preference.\n\n##### mediaTypes(availableMediaTypes)\n\nReturns an array of preferred media types ordered by priority from a list of\navailable media types.\n\n### Accept-Language Negotiation\n\n```js\nnegotiator = new Negotiator(request)\n\navailableLanguages = ['en', 'es', 'fr']\n\n// Let's say Accept-Language header is 'en;q=0.8, es, pt'\n\nnegotiator.languages()\n// -> ['es', 'pt', 'en']\n\nnegotiator.languages(availableLanguages)\n// -> ['es', 'en']\n\nlanguage = negotiator.language(availableLanguages)\n// -> 'es'\n```\n\nYou can check a working example at `examples/language.js`.\n\n#### Methods\n\n##### language()\n\nReturns the most preferred language from the client.\n\n##### language(availableLanguages)\n\nReturns the most preferred language from a list of available languages.\n\n##### languages()\n\nReturns an array of preferred languages ordered by the client preference.\n\n##### languages(availableLanguages)\n\nReturns an array of preferred languages ordered by priority from a list of\navailable languages.\n\n### Accept-Charset Negotiation\n\n```js\navailableCharsets = ['utf-8', 'iso-8859-1', 'iso-8859-5']\n\nnegotiator = new Negotiator(request)\n\n// Let's say Accept-Charset header is 'utf-8, iso-8859-1;q=0.8, utf-7;q=0.2'\n\nnegotiator.charsets()\n// -> ['utf-8', 'iso-8859-1', 'utf-7']\n\nnegotiator.charsets(availableCharsets)\n// -> ['utf-8', 'iso-8859-1']\n\nnegotiator.charset(availableCharsets)\n// -> 'utf-8'\n```\n\nYou can check a working example at `examples/charset.js`.\n\n#### Methods\n\n##### charset()\n\nReturns the most preferred charset from the client.\n\n##### charset(availableCharsets)\n\nReturns the most preferred charset from a list of available charsets.\n\n##### charsets()\n\nReturns an array of preferred charsets ordered by the client preference.\n\n##### charsets(availableCharsets)\n\nReturns an array of preferred charsets ordered by priority from a list of\navailable charsets.\n\n### Accept-Encoding Negotiation\n\n```js\navailableEncodings = ['identity', 'gzip']\n\nnegotiator = new Negotiator(request)\n\n// Let's say Accept-Encoding header is 'gzip, compress;q=0.2, identity;q=0.5'\n\nnegotiator.encodings()\n// -> ['gzip', 'identity', 'compress']\n\nnegotiator.encodings(availableEncodings)\n// -> ['gzip', 'identity']\n\nnegotiator.encoding(availableEncodings)\n// -> 'gzip'\n```\n\nYou can check a working example at `examples/encoding.js`.\n\n#### Methods\n\n##### encoding()\n\nReturns the most preferred encoding from the client.\n\n##### encoding(availableEncodings)\n\nReturns the most preferred encoding from a list of available encodings.\n\n##### encodings()\n\nReturns an array of preferred encodings ordered by the client preference.\n\n##### encodings(availableEncodings)\n\nReturns an array of preferred encodings ordered by priority from a list of\navailable encodings.\n\n## See Also\n\nThe [accepts](https://npmjs.org/package/accepts#readme) module builds on\nthis module and provides an alternative interface, mime type validation,\nand more.\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/negotiator.svg\n[npm-url]: https://npmjs.org/package/negotiator\n[node-version-image]: https://img.shields.io/node/v/negotiator.svg\n[node-version-url]: https://nodejs.org/en/download/\n[coveralls-image]: https://img.shields.io/coveralls/jshttp/negotiator/master.svg\n[coveralls-url]: https://coveralls.io/r/jshttp/negotiator?branch=master\n[downloads-image]: https://img.shields.io/npm/dm/negotiator.svg\n[downloads-url]: https://npmjs.org/package/negotiator\n[github-actions-ci-image]: https://img.shields.io/github/workflow/status/jshttp/negotiator/ci/master?label=ci\n[github-actions-ci-url]: https://github.com/jshttp/negotiator/actions/workflows/ci.yml\n","publish_time":1556584230629,"_cnpm_publish_time":1556584230629,"dist-tags":{"latest":"1.1.0","legacy":"0.6.4"}}