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

@hapi/accept

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hapi/accept - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

30

lib/header.js

@@ -82,7 +82,7 @@ 'use strict';

const lowers = Object.create(null);
const lowers = new Map();
if (preferences) {
for (let i = 0; i < preferences.length; ++i) {
const preference = preferences[i];
lowers[preference.toLowerCase()] = { orig: preference, pos: i };
lowers.set(preference.toLowerCase(), { orig: preference, pos: i });
}

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

const selections = [];
const map = {};
const map = new Set();

@@ -117,5 +117,5 @@ for (let i = 0; i < parts.length; ++i) {

if (options.equivalents &&
options.equivalents[token]) {
options.equivalents.has(token)) {
token = options.equivalents[token];
token = options.equivalents.get(token);
}

@@ -131,8 +131,8 @@

if (preferences &&
lowers[token]) {
lowers.has(token)) {
selection.pref = lowers[token].pos;
selection.pref = lowers.get(token).pos;
}
map[selection.token] = selection;
map.add(selection.token);

@@ -146,3 +146,3 @@ // Parse q=value

if (!value ||
(key !== 'q' && key !== 'Q')) {
key !== 'q' && key !== 'Q') {

@@ -177,3 +177,3 @@ throw Boom.badRequest(`Invalid ${options.type} header`);

if (options.default &&
!map[options.default]) {
!map.has(options.default)) {

@@ -192,5 +192,5 @@ values.push(options.default);

if (selection === '*') {
for (const preference of Object.keys(lowers)) {
if (!map[preference]) {
preferred.push(lowers[preference].orig);
for (const [preference, value] of lowers) {
if (!map.has(preference)) {
preferred.push(value.orig);
}

@@ -201,4 +201,4 @@ }

const lower = selection.toLowerCase();
if (lowers[lower]) {
preferred.push(lowers[lower].orig);
if (lowers.has(lower)) {
preferred.push(lowers.get(lower).orig);
}

@@ -205,0 +205,0 @@ }

@@ -15,6 +15,6 @@ 'use strict';

default: 'identity',
equivalents: {
'x-compress': 'compress',
'x-gzip': 'gzip'
}
equivalents: new Map([
['x-compress', 'compress'],
['x-gzip', 'gzip']
])
},

@@ -21,0 +21,0 @@ language: {

{
"name": "@hapi/accept",
"description": "HTTP Accept-* headers parsing",
"version": "4.0.0",
"version": "4.0.1",
"repository": "git://github.com/hapijs/accept",

@@ -6,0 +6,0 @@ "main": "lib/index.js",

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