🚀 Socket Launch Week 🚀 Day 4: Introducing Historical Analytics.Learn More
Socket
Sign inDemoInstall
Socket

@fastify/accept-negotiator

Package Overview
Dependencies
Maintainers
17
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/accept-negotiator - npm Package Compare versions

Comparing version

to
1.1.0

16

package.json
{
"name": "@fastify/accept-negotiator",
"version": "1.0.0",
"version": "1.1.0",
"description": "a negotiator for the accept-headers",

@@ -9,4 +9,6 @@ "type": "commonjs",

"scripts": {
"test": "tsd && nyc node ./test/index.js",
"lint": "standard index.js test/* benchmarks/*"
"lint": "standard index.js test/* benchmarks/*",
"test": "npm run test:unit && npm run test:typescript",
"test:unit": "tap",
"test:typescript": "tsd"
},

@@ -36,5 +38,5 @@ "standard": {

"benchmark": "2.1.4",
"nyc": "15.1.0",
"standard": "17.0.0",
"tsd": "^0.21.0"
"tap": "^16.3.0",
"tsd": "^0.24.1"
},

@@ -46,7 +48,7 @@ "engines": {

"type": "git",
"url": "git+https://github.com/@fastify/encoding-negotiator.git"
"url": "git+https://github.com/fastify/accept-negotiator.git"
},
"bugs": {
"url": "https://github.com/fastify/encoding-negotiator/issues"
"url": "https://github.com/fastify/accept-negotiator/issues"
}
}
# @fastify/accept-negotiator
![CI](https://github.com/fastify/fastify-accept-negotiator/workflows/CI/badge.svg)
[![CI](https://github.com/fastify/accept-negotiator/workflows/CI/badge.svg)](https://github.com/fastify/accept-negotiator/actions/workflows/ci.yml)
[![NPM version](https://img.shields.io/npm/v/@fastify/accept-negotiator.svg?style=flat)](https://www.npmjs.com/package/@fastify/accept-negotiator)

@@ -27,3 +27,3 @@ [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)

```js
const negotiate = require('@fastify/accept-encoding').negotiate
const negotiate = require('@fastify/accept-negotiator').negotiate
const encoding = negotiate('gzip, deflate, br', ['br'])

@@ -44,3 +44,3 @@ console.log(encoding) // 'br*

```js
const Negotiator = require('@fastify/accept-encoding').Negotiator
const Negotiator = require('@fastify/accept-negotiator').Negotiator
const encodingNegotiator = new Negotiator({ supportedValues: ['br'], cache: new Map() })

@@ -54,2 +54,2 @@

Licensed under [MIT](./LICENSE).
Licensed under [MIT](./LICENSE).
type CacheStore = { set: (key: string, value: string) => CacheStore, get: (key: string) => string | undefined, has: (key: string) => boolean }
export class Negotiator<K extends string = string> {
constructor (options: { supportedValues: K[]; cache?: CacheStore })
type NegotiateFn = typeof negotiate
negotiate(header: string): K | null
declare namespace negotiate {
export class Negotiator<K extends string = string> {
constructor (options: { supportedValues: K[]; cache?: CacheStore })
negotiate(header: string): K | null
}
export const negotiate: NegotiateFn
export { negotiate as default }
}
export function negotiate<K extends string = string>(header: string, supportedValues: K[]): K | null;
export default negotiate;
declare function negotiate<K extends string = string>(header: string, supportedValues: K[]): K | null;
export = negotiate;