@fastify/accept-negotiator
Advanced tools
Comparing version
{ | ||
"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 | ||
 | ||
[](https://github.com/fastify/accept-negotiator/actions/workflows/ci.yml) | ||
[](https://www.npmjs.com/package/@fastify/accept-negotiator) | ||
@@ -27,3 +27,3 @@ [](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; |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
8197
3.54%164
3.14%0
-100%53
1.92%1
Infinity%