format-bcp-47

1.0.0 • Public • Published

format-bcp-47

Validates BCP-47 Language Tags using the npm package bcp-47 and formats them in a unique way to ensure consistency.

Install

npm i format-bcp-47

Usage

const formatBcp47 = require('format-bcp-47');
console.log(formatBcp47('de-ch'));
console.log(formatBcp47('de-ch') === formatBcp47('DE-ch'));
console.log(formatBcp47(6757547547546754653));
/* CONSOLE:
de-CH
true
null
*/

Returns null if the valdiation fails, otherwise it returns a valid and formatted BCP-47 language tag.

What does it exactly?

It validates using bcp-47 and does some uppercase / lowercase formatting.

Package Sidebar

Install

npm i format-bcp-47

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • supuk