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

@kmdavis/carmen

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kmdavis/carmen

What in the world is en-US-sandiego?

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Carmen

What in the world is en-US-sandiego?

NPM Version Build Status Downloads Stats

Carmen.js is, in a nutshell, a RFC-4646 & RFC-5646 parser. In other words, Carmen will parse strings like "en-US-sandiego" and tell you that it refers to the english language, in the United States, specifically, the variant spoken in San Diego.

Installation

npm install @kmdavis/carmen

Usage

import carmen from "@kmdavis/carmen";
carmen("en-US");

will return

{
  text: "en-US",
  language: "en",
  region: "US",
}

and

carmen("sl-Latn-IT-nedis");

will return

{
  text: "sl-Latn-IT-nedis",
  language: "sl",
  script: "Latn'"
  region: "IT",
  variants: ["nedis"],
}

The full list of fields that Carmen can return is:

{
  text:        String,
  language:    String,
  extlangs:    [String],
  script:      String,
  region:      String,
  variants:   [String],
  extensions:  Object,
  private:    [String],
  grandfather: String
}

Please note that the "text" field is Not the original string that is passed in. This string is reconstructed from the parsed values; as such, any minor formatting errors (such as the common Internet Exploder bug where en-US becomes en_US) will be normalized.

Development setup

npm install
npm test

Release History

  • 0.1.0
    • Initial public release
  • 0.2.0
    • Rewrite using modern javascript
  • 0.2.1
    • Readding keywords
  • 0.2.2
    • Switching to webpack

Meta

Kevan Davis kevan.davis@me.com

Distributed under the MIT license.

https://github.com/kmdavis/carmen

Contributing

  1. Fork it (https://github.com/kmdavis/carmen/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Keywords

FAQs

Package last updated on 12 Apr 2019

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