You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

bcp47

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bcp47

Parser for the BCP 47 language tag specification


Version published
Weekly downloads
165K
decreased by-13.17%
Maintainers
1
Install size
6.46 kB
Created
Weekly downloads
 

Package description

What is bcp47?

The bcp47 npm package is a utility for parsing, validating, and manipulating BCP 47 language tags. BCP 47 is a standard for language tags that are used to identify human languages in a standardized way.

What are bcp47's main functionalities?

Parsing BCP 47 Language Tags

This feature allows you to parse a BCP 47 language tag into its components. For example, 'en-US' would be parsed into an object representing the language 'English' and the region 'United States'.

const bcp47 = require('bcp47');
const parsedTag = bcp47.parse('en-US');
console.log(parsedTag);

Validating BCP 47 Language Tags

This feature allows you to validate whether a given string is a valid BCP 47 language tag. For example, 'en-US' would return true, indicating it is a valid tag.

const bcp47 = require('bcp47');
const isValid = bcp47.validate('en-US');
console.log(isValid);

Stringifying BCP 47 Language Tags

This feature allows you to convert an object representing a BCP 47 language tag back into its string form. For example, an object with language 'en' and region 'US' would be converted back to 'en-US'.

const bcp47 = require('bcp47');
const tagObject = { language: 'en', region: 'US' };
const tagString = bcp47.stringify(tagObject);
console.log(tagString);

Other packages similar to bcp47

Readme

Source

bcp47

Parser for the BCP 47 language tag specification

npm travis coveralls

BCP 47

module.parse(tag) : Object
Parses the language tag and returns an object with all the available information. If the tag is not valid it returns null. Look at the examples folder to see what information returns.

Keywords

FAQs

Package last updated on 06 Feb 2015

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc