Socket
Socket
Sign inDemoInstall

acc-lang-parser

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    acc-lang-parser

A simple parser for http Accept-Language headers.


Version published
Weekly downloads
779
increased by6.71%
Maintainers
1
Install size
16.5 kB
Created
Weekly downloads
 

Readme

Source

acc-lang-parser

A simple parser for http Accept-Language Headers in nodejs.

usage

To only get the first language of the header:

var accLangParser = require("parse-acc-lang");
var result = accLangParser.extractFirstLang("de-DE");

result => {language: "de", locale: "DE"}

To get a list of all languages:

var accLangParser = require("parse-acc-lang");
var result = accLangParser.extractAllLangs("de-DE, en-GB");

result => [{language: "de", locale: "DE"}
		  ,{language: "en", locale: "GB"}]

Take a look into the specs for more details about invalid handlers.

Use accLangParser.extractFirstLang if you only interested in the first language range, because this function will skip on parsing the other ranges.

testing

To run the test:

jasmine-node spec/
or
npm test

license

The license can be found in license.md.

Keywords

FAQs

Last updated on 30 Aug 2012

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc