Socket
Socket
Sign inDemoInstall

@types/accept-language-parser

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/accept-language-parser

TypeScript definitions for accept-language-parser


Version published
Weekly downloads
101K
decreased by-17.77%
Maintainers
1
Weekly downloads
 
Created

What is @types/accept-language-parser?

@types/accept-language-parser provides TypeScript type definitions for the accept-language-parser package, which is used to parse the Accept-Language header from HTTP requests. This package helps in determining the preferred languages of a user based on their browser settings.

What are @types/accept-language-parser's main functionalities?

Parse Accept-Language Header

This feature allows you to parse the Accept-Language header from an HTTP request. The code sample demonstrates how to parse a given Accept-Language header string and output the parsed languages.

const acceptLanguageParser = require('accept-language-parser');
const header = 'en-GB,en;q=0.8,fr;q=0.7';
const languages = acceptLanguageParser.parse(header);
console.log(languages);

Get Best Match

This feature allows you to determine the best match from a list of supported languages based on the Accept-Language header. The code sample shows how to find the best match from a list of supported languages.

const acceptLanguageParser = require('accept-language-parser');
const header = 'en-GB,en;q=0.8,fr;q=0.7';
const supportedLanguages = ['en', 'fr'];
const bestMatch = acceptLanguageParser.pick(supportedLanguages, header);
console.log(bestMatch);

Other packages similar to @types/accept-language-parser

FAQs

Package last updated on 06 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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