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

bcp-47

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bcp-47

Parse and stringify BCP 47 language tags

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is bcp-47?

The bcp-47 npm package is used 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 bcp-47'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('bcp-47');
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('bcp-47');
const isValid = bcp47.validate('en-US');
console.log(isValid);

Formatting BCP 47 Language Tags

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

const bcp47 = require('bcp-47');
const formattedTag = bcp47.stringify({ language: 'en', region: 'US' });
console.log(formattedTag);

Other packages similar to bcp-47

Keywords

FAQs

Package last updated on 08 Nov 2021

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