JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 294432
  • Score
    100M100P100Q174072F

Parser for the BCP 47 language tag specification

Package Exports

  • bcp47

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bcp47) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

bcp47

Node.js project

Parser for the BCP 47 language tag specification

Version: 1.0.1

Installation

npm install bcp47

Example

var bcp47 = require ("bcp47");

//Eastern Armenian written in Latin script, as used in Italy
var tag = "hy-Latn-IT-arevela";

console.log (bcp47.isValid (tag)); //true

console.log (bcp47.parse (tag));

/*
Prints:

{
    language: {
        language: "hy",
        extlang: []
    },
    script: "Latn",
    region: "IT",
    variant: ["arevela"],
    extension: [],
    privateuse: [],
    grandfathered: {
        irregular: null,
        regular: null
    }
}
*/