Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tinyhttp/accepts

Package Overview
Dependencies
Maintainers
0
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tinyhttp/accepts - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

4

dist/index.d.ts

@@ -1,4 +0,4 @@

/// <reference types="node" />
import Negotiator from 'negotiator';
import { IncomingMessage as I, IncomingHttpHeaders } from 'node:http';
import { default as Negotiator } from 'negotiator';
export declare class Accepts {

@@ -5,0 +5,0 @@ headers: IncomingHttpHeaders;

@@ -0,5 +1,5 @@

import mime from "mime";
import Negotiator from "negotiator";
import mime from "mime";
const extToMime = (type) => type.indexOf("/") == -1 ? mime.getType(type) : type;
const validMime = (type) => typeof type == "string";
const extToMime = (type) => type.indexOf("/") === -1 ? mime.getType(type) : type;
const validMime = (type) => typeof type === "string";
class Accepts {

@@ -22,6 +22,6 @@ constructor(req) {

}
if (!mimeTypes || mimeTypes.length == 0) {
if (!mimeTypes || mimeTypes.length === 0) {
return this.negotiator.mediaTypes();
}
if (!this.headers["accept"]) {
if (!this.headers.accept) {
return mimeTypes[0];

@@ -50,3 +50,3 @@ }

}
if (!_encodings || _encodings.length == 0) {
if (!_encodings || _encodings.length === 0) {
return this.negotiator.encodings();

@@ -72,3 +72,3 @@ }

}
if (!_charsets || _charsets.length == 0) {
if (!_charsets || _charsets.length === 0) {
return this.negotiator.charsets();

@@ -95,3 +95,3 @@ }

}
if (!_languages || _languages.length == 0) {
if (!_languages || _languages.length === 0) {
return this.negotiator.languages();

@@ -98,0 +98,0 @@ }

{
"name": "@tinyhttp/accepts",
"description": "accepts rewrite in TypeScript",
"version": "2.2.1",
"version": "2.2.2",
"license": "MIT",

@@ -6,0 +6,0 @@ "homepage": "https://tinyhttp.v1rtl.site",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc