Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
The iso-639-1 npm package provides utilities for working with ISO 639-1 language codes. It allows you to get language names from codes, get codes from language names, and check if a language code is valid.
Get Language Name from Code
This feature allows you to get the name of a language given its ISO 639-1 code. In the example, the code 'en' returns 'English'.
const ISO6391 = require('iso-639-1');
const languageName = ISO6391.getName('en');
console.log(languageName); // Output: English
Get Language Code from Name
This feature allows you to get the ISO 639-1 code of a language given its name. In the example, the name 'English' returns the code 'en'.
const ISO6391 = require('iso-639-1');
const languageCode = ISO6391.getCode('English');
console.log(languageCode); // Output: en
Check if a Language Code is Valid
This feature allows you to check if a given ISO 639-1 code is valid. In the example, the code 'en' is validated and returns true.
const ISO6391 = require('iso-639-1');
const isValid = ISO6391.validate('en');
console.log(isValid); // Output: true
Get All Language Codes
This feature allows you to get an array of all ISO 639-1 language codes. The example returns an array containing all the codes.
const ISO6391 = require('iso-639-1');
const allCodes = ISO6391.getAllCodes();
console.log(allCodes); // Output: Array of all ISO 639-1 language codes
Get All Language Names
This feature allows you to get an array of all ISO 639-1 language names. The example returns an array containing all the names.
const ISO6391 = require('iso-639-1');
const allNames = ISO6391.getAllNames();
console.log(allNames); // Output: Array of all ISO 639-1 language names
The iso-639 package provides similar functionality for working with ISO 639 language codes, including both ISO 639-1 and ISO 639-2. It offers methods to get language names, codes, and validate codes. Compared to iso-639-1, it supports a broader range of language codes.
The language-codes package provides a comprehensive list of language codes and their corresponding names, including ISO 639-1, ISO 639-2, and ISO 639-3. It offers more extensive data and supports multiple standards, making it more versatile than iso-639-1.
The langs package provides utilities for working with language codes, including ISO 639-1, ISO 639-2, and ISO 639-3. It offers methods to get language names, codes, and validate codes. It is more comprehensive than iso-639-1, supporting multiple ISO standards.
Simple interface for ISO-639-1 language codes
npm install iso-639-1
const ISO6391 = require('iso-639-1');
console.log(ISO6391.getName('en')); // 'English'
import ISO6391 from 'iso-639-1';
console.log(ISO6391.getName('en')); // 'English'
HTML
<script type="text/javascript" src="./node_modules/iso-639-1/build/index.js"></script>
Visit global variable ISO6391 in js
console.log(ISO6391.getName('en')); // 'English'
Lookup language english name by code
Get array of all language english names
Lookup language native name by code
Get array of all language native names
Lookup code by english name or native name
Get array of all codes
Check whether the given code is in the list of ISO-639-1
Get the array of the language objects by the given codes
const ISO6391 = require('iso-639-1')
console.log(ISO6391.getName('zh')) // 'Chinese'
console.log(ISO6391.getNativeName('zh')) // '中文'
console.log(ISO6391.getAllNames()) // ['Afar','Abkhaz', ... ,'Zulu']
console.log(ISO6391.getAllNativeNames()) //['Afaraf','аҧсуа бызшәа', ... ,'isiZulu' ]
console.log(ISO6391.getCode('Chinese')) // 'zh'
console.log(ISO6391.getCode('中文')) // 'zh'
console.log(ISO6391.getAllCodes()) //['aa','ab',...,'zu']
console.log(ISO6391.validate('en')) // true
console.log(ISO6391.validate('xx')) // false
console.log(ISO6391.getLanguages(['en', 'zh']))
// [{code:'en',name:'English',nativeName:'English'},{code:'zh',name:'Chinese',nativeName:'中文'}]
v3.1.3
FAQs
ISO-639-1 codes
The npm package iso-639-1 receives a total of 203,764 weekly downloads. As such, iso-639-1 popularity was classified as popular.
We found that iso-639-1 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.