|
Download ADOOR_ACE/node_modules/accept-language-parser/README.md from thisisAce/adoor-store: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/thisisAce/adoor-store/resolve/main/ADOOR_ACE/node_modules/accept-language-parser/README.md
- Command line
-
hf download hf://thisisAce/adoor-store/ADOOR_ACE/node_modules/accept-language-parser/README.md
-
curl -L -o README.md https://huggingface.co/thisisAce/adoor-store/resolve/main/ADOOR_ACE/node_modules/accept-language-parser/README.md
1.29 kB
accept-language-parser
Parses the accept-language header from an HTTP request and produces an array of language objects sorted by quality.
dependencies: none
installation:
npm install accept-language-parser
parse usage:
var parser = require('accept-language-parser');
var languages = parser.parse('en-GB,en;q=0.8');
console.log(languages);
Output will be:
[
{
code: "en",
region: "GB",
quality: 1.0
},
{
code: "en",
region: undefined,
quality: 0.8
}
];
Output is always sorted in quality order from highest -> lowest. as per the http spec, omitting the quality value implies 1.0.
pick usage:
var parser = require('accept-language-parser');
var language = parser.pick(['fr-CA', 'fr-FR', 'fr'], 'en-GB,en-US;q=0.9,fr-CA;q=0.7,en;q=0.8');
console.log(language);
Output will be:
"fr-CA"
Running tests
npm install
grunt test


