@tinyhttp/accepts
Advanced tools
Comparing version 2.0.9 to 2.1.0
import Negotiator from 'negotiator'; | ||
import { IncomingMessage as I, IncomingHttpHeaders } from 'http'; | ||
import { IncomingMessage as I, IncomingHttpHeaders } from 'node:http'; | ||
export declare class Accepts { | ||
@@ -4,0 +4,0 @@ headers: IncomingHttpHeaders; |
{ | ||
"name": "@tinyhttp/accepts", | ||
"description": "accepts rewrite in TypeScript", | ||
"version": "2.0.9", | ||
"version": "2.1.0", | ||
"license": "MIT", | ||
@@ -17,3 +17,3 @@ "homepage": "https://tinyhttp.v1rtl.site", | ||
"engines": { | ||
"node": ">=12.4.0" | ||
"node": ">=12.20.0" | ||
}, | ||
@@ -20,0 +20,0 @@ "type": "module", |
@@ -5,9 +5,11 @@ # @tinyhttp/accepts | ||
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator). | ||
Extracted from [koa](https://www.npmjs.com/package/koa) for general use. | ||
Higher level content negotiation based on | ||
[negotiator](https://www.npmjs.com/package/negotiator). Extracted from | ||
[koa](https://www.npmjs.com/package/koa) for general use. | ||
In addition to negotiator, it allows: | ||
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])` | ||
as well as `('text/html', 'application/json')`. | ||
- Allows types as an array or arguments list, ie | ||
`(['text/html', 'application/json'])` as well as | ||
`('text/html', 'application/json')`. | ||
- Allows type shorthands such as `json`. | ||
@@ -35,4 +37,4 @@ - Returns `false` when no types match | ||
Return the first accepted charset. If nothing in `charsets` is accepted, | ||
then `false` is returned. | ||
Return the first accepted charset. If nothing in `charsets` is accepted, then | ||
`false` is returned. | ||
@@ -46,4 +48,4 @@ #### `.charsets()` | ||
Return the first accepted encoding. If nothing in `encodings` is accepted, | ||
then `false` is returned. | ||
Return the first accepted encoding. If nothing in `encodings` is accepted, then | ||
`false` is returned. | ||
@@ -57,4 +59,4 @@ #### `.encodings()` | ||
Return the first accepted language. If nothing in `languages` is accepted, | ||
then `false` is returned. | ||
Return the first accepted language. If nothing in `languages` is accepted, then | ||
`false` is returned. | ||
@@ -72,4 +74,4 @@ #### `.languages()` | ||
The `types` array can contain full MIME types or file extensions. Any value | ||
that is not a full MIME types is passed to `require('mime-types').lookup`. | ||
The `types` array can contain full MIME types or file extensions. Any value that | ||
is not a full MIME types is passed to `require('mime-types').lookup`. | ||
@@ -90,3 +92,3 @@ #### `.types()` | ||
import Accepts from '@tinyhttp/accepts' | ||
import { createServer } from 'http' | ||
import { createServer } from 'node:http' | ||
@@ -93,0 +95,0 @@ createServer((req, res) => { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12324
118