encoding-negotiator
Advanced tools
Comparing version
{ | ||
"name": "encoding-negotiator", | ||
"version": "2.0.1", | ||
"version": "3.0.0", | ||
"description": "a negotiator for the accept-encoding header", | ||
"main": "index.js", | ||
"main": "index.mjs", | ||
"type": "module", | ||
"scripts": { | ||
"unit": "ava test/*.js", | ||
"test": "npm run lint && npm run unit", | ||
"lint": "standard index.js test/* benchmark/*", | ||
"coveralls": "nyc npm test" | ||
"unit": "ava test/*.mjs", | ||
"test": "npx prettier index.mjs test/* benchmark/* --check && npm run lint && npm run unit", | ||
"lint": "eslint index.mjs test/* benchmark/*", | ||
"prettier": "npx prettier index.mjs test/* benchmark/* --write", | ||
"coverage": "c8 --reporter=lcov npm test" | ||
}, | ||
@@ -23,10 +25,13 @@ "keywords": [ | ||
"devDependencies": { | ||
"ava": "^3.0.0", | ||
"@eslint/js": "^9.29.0", | ||
"ava": "^6.4.0", | ||
"benchmark": "^2.1.4", | ||
"negotiator": "^0.6.2", | ||
"nyc": "^15.0.0", | ||
"standard": "^14.0.0" | ||
"c8": "^10.1.3", | ||
"eslint": "^9.29.0", | ||
"globals": "^16.2.0", | ||
"negotiator": "^1.0.0", | ||
"prettier": "3.6.0" | ||
}, | ||
"engines": { | ||
"node": ">=10.13.0" | ||
"node": ">=20.19.3" | ||
}, | ||
@@ -33,0 +38,0 @@ "repository": { |
@@ -7,13 +7,12 @@ # encoding-negotiator | ||
[](https://www.npmjs.com/package/encoding-negotiator) | ||
[](https://standardjs.com) | ||
[](https://greenkeeper.io/) | ||
``` | ||
npm install encoding-negotiator | ||
npm i encoding-negotiator -S | ||
``` | ||
## Example | ||
```js | ||
const encodingNegotiator = require('encoding-negotiator'); | ||
encodingNegotiator.negotiate({ | ||
```mjs | ||
import negotiateEncoding from 'encoding-negotiator'; | ||
negotiateEncoding({ | ||
header: 'compress;q=0.5, gzip;q=1.0', | ||
@@ -24,7 +23,6 @@ supportedEncodings: ['gzip', 'deflate', 'identity'] | ||
## API | ||
### negotiate(header, supported) | ||
### negotiateEncoding(header, supported) | ||
Returns the most preffered encoding available in `supportedEncodings` The first | ||
element of the `supportedEncodings` array will be used in case of an asterisk. | ||
#### header | ||
@@ -47,4 +45,4 @@ | ||
$ node benchmark/benchmark.js | ||
negotiator x 260,201 ops/sec ±0.64% (88 runs sampled) | ||
encoding-negotiator x 434,196 ops/sec ±1.23% (88 runs sampled) | ||
negotiator x 863,149 ops/sec ±0.40% (99 runs sampled) | ||
encoding-negotiator x 2,346,708 ops/sec ±0.53% (98 runs sampled) | ||
Fastest is encoding-negotiator | ||
@@ -55,2 +53,2 @@ ``` | ||
[MIT](./LICENSE) | ||
[MIT](./LICENSE) |
Sorry, the diff of this file is not supported yet
Yes
NaN8
60%69
-1.43%51
-1.92%