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

acc-lang-parser

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acc-lang-parser

A simple parser for http Accept-Language headers.

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
956
decreased by-3.73%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 30 Aug 2012

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