parse-accept-language-header
v1.0.0
Published
Parse an accept-language header as described in [the HTTP/1.1 spec](https://httpwg.org/specs/rfc7231.html#header.accept-language) into an navigator.languages array as described in [the html spec](https://html.spec.whatwg.org/multipage/system-state.html#do
Downloads
4
Maintainers
Readme
parse-accept-language-header
Parse an accept-language header as described in the HTTP/1.1 spec into an navigator.languages array as described in the html spec
Installation
npm i parse-accept-language-header
Usage
import { parseAcceptLanguageHeader } from 'parse-accept-language-header';
const languages = parseAcceptLanguageHeader('fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5');
console.log(languages) // -> 'fr-CH', 'fr', 'en', 'de'