You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

encoding-negotiator

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

encoding-negotiator - npm Package Compare versions

Comparing version

to
3.0.0

index.mjs

27

package.json
{
"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

[![NPM version](https://img.shields.io/npm/v/encoding-negotiator.svg?style=flat)](https://www.npmjs.com/package/encoding-negotiator)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![Greenkeeper badge](https://badges.greenkeeper.io/SerayaEryn/encoding-negotiator.svg)](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