New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rfc5646

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rfc5646 - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

example.js

20

package.json
{
"name": "rfc5646",
"version": "2.0.0",
"version": "3.0.0",
"description": "RFC 5646 Language Tags Implementation",
"license": "Public Domain",
"keywords": [
"rfc5646",
"languagetag"
],
"maintainers": [
"James M Snell <jasnell@us.ibm.com> (http://www.chmod777self.com)"
],
"keywords": [ "rfc5646", "languagetag" ],
"author": "James M Snell <jasnell@gmail.com>",
"scripts": {
"test": "mocha"
"test": "standard && mocha test -R tap"
},
"devDependencies": {
"async": "^1.4.0",
"mocha": "^2.2.5"
"async": "^2.5.0",
"mocha": "^4.0.1",
"standard": "^10.0.3"
},
"main": "./src/main.js",
"main": "main.js",
"repository": {

@@ -22,0 +18,0 @@ "type": "git",

# RFC 5646 Language Tag Implementation
Basic Language Tag handling. Does not attempt to do validation against
the registry. If you need a more complete implementation, look at
https://www.npmjs.com/package/language-tags by https://www.npmjs.com/~mcg
the registry.

@@ -12,2 +11,6 @@ License: Public Domain

```bash
yarn add rfc5646
```
```bash
npm install rfc5646

@@ -18,7 +21,9 @@ ```

```javascript
var LanguageTag = require('rfc5646');
```js
const LanguageTag = require('rfc5646');
var tag = LanguageTag('en-Latn-US');
// (The new keyword is required)
const tag = new LanguageTag('en-Latn-US');
// Immutable properties
console.log(tag.language); // en

@@ -31,2 +36,3 @@ console.log(tag.script); // Latn

console.log(tag.matches('en-*')); // true
console.log(tag.suitableFor('en-US')); // true
console.log(tag.minimal.suitableFor('en-US')); // true

@@ -36,7 +42,7 @@ console.log(tag.truncate().toString()); // en-Latn-US

tag.forEach(function(subtag) {
console.log(subtag.toString());
});
// ES6 Iteration...
tag.forEach((subtag) => console.log(subtag.toString()));
tag = LanguageTag('en-US-a-abc-b-xyz-x-123');
// Extensions and Private Use Tags
tag = new LanguageTag('en-US-a-abc-b-xyz-x-123');

@@ -46,3 +52,2 @@ console.log(tag.extensions.a.toString()); // a-abc

console.log(tag.privateuse.toString()); // x-123
```
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