i18n-iso-countries
Advanced tools
Comparing version 6.3.0 to 6.4.0
var library = require("./index"); | ||
var locales = [ | ||
require("./langs/af.json"), | ||
require("./langs/am.json"), | ||
require("./langs/ha.json"), | ||
require("./langs/ku.json"), | ||
require("./langs/ml.json"), | ||
require("./langs/no.json"), | ||
require("./langs/ps.json"), | ||
require("./langs/sd.json"), | ||
require("./langs/so.json"), | ||
require("./langs/sq.json"), | ||
require("./langs/ta.json"), | ||
require("./langs/tg.json"), | ||
require("./langs/tt.json"), | ||
require("./langs/ug.json"), | ||
require("./langs/ur.json"), | ||
@@ -5,0 +19,0 @@ require("./langs/vi.json"), |
26
index.js
"use strict"; | ||
var codes = require("./codes.json"); | ||
var removeDiacritics = require("diacritics").remove; | ||
var registeredLocales = {}; | ||
const codes = require("./codes.json"); | ||
const removeDiacritics = require("diacritics").remove; | ||
const registeredLocales = {}; | ||
@@ -10,3 +10,3 @@ /* | ||
*/ | ||
var alpha2 = {}, | ||
const alpha2 = {}, | ||
alpha3 = {}, | ||
@@ -17,3 +17,3 @@ numeric = {}, | ||
codes.forEach(function (codeInformation) { | ||
var s = codeInformation; | ||
const s = codeInformation; | ||
alpha2[s[0]] = s[1]; | ||
@@ -152,3 +152,3 @@ alpha3[s[1]] = s[0]; | ||
function numericToAlpha3(code) { | ||
var padded = formatNumericCode(code); | ||
const padded = formatNumericCode(code); | ||
return alpha2ToAlpha3(numeric[padded]); | ||
@@ -163,3 +163,3 @@ } | ||
function numericToAlpha2(code) { | ||
var padded = formatNumericCode(code); | ||
const padded = formatNumericCode(code); | ||
return numeric[padded]; | ||
@@ -244,3 +244,3 @@ } | ||
} | ||
var localeList = registeredLocales[lang.toLowerCase()]; | ||
const localeList = registeredLocales[lang.toLowerCase()]; | ||
if (localeList === undefined) return {}; | ||
@@ -333,5 +333,5 @@ return localeFilter(localeList, function (nameList) { | ||
exports.getAlpha3Code = function (name, lang) { | ||
var alpha2 = this.getAlpha2Code(name, lang); | ||
const alpha2 = exports.getAlpha2Code(name, lang); | ||
if (alpha2) { | ||
return this.toAlpha3(alpha2); | ||
return exports.toAlpha3(alpha2); | ||
} else { | ||
@@ -348,5 +348,5 @@ return undefined; | ||
exports.getSimpleAlpha3Code = function (name, lang) { | ||
var alpha2 = this.getSimpleAlpha2Code(name, lang); | ||
const alpha2 = exports.getSimpleAlpha2Code(name, lang); | ||
if (alpha2) { | ||
return this.toAlpha3(alpha2); | ||
return exports.toAlpha3(alpha2); | ||
} else { | ||
@@ -387,3 +387,3 @@ return undefined; | ||
var coerced = code.toString().toUpperCase(); | ||
const coerced = code.toString().toUpperCase(); | ||
return ( | ||
@@ -390,0 +390,0 @@ hasOwnProperty(alpha3, coerced) || |
{ | ||
"name": "i18n-iso-countries", | ||
"version": "6.3.0", | ||
"version": "6.4.0", | ||
"description": "i18n for ISO 3166-1 country codes", | ||
@@ -18,2 +18,4 @@ "typings": "index.d.ts", | ||
"countries", | ||
"af", | ||
"am", | ||
"ar", | ||
@@ -37,2 +39,3 @@ "az", | ||
"gl", | ||
"ha", | ||
"he", | ||
@@ -50,2 +53,3 @@ "hi", | ||
"ko", | ||
"ku", | ||
"ky", | ||
@@ -55,2 +59,3 @@ "lt", | ||
"mk", | ||
"ml", | ||
"mn", | ||
@@ -61,10 +66,16 @@ "ms", | ||
"nn", | ||
"no", | ||
"pl", | ||
"ps", | ||
"pt", | ||
"ro", | ||
"ru", | ||
"sd", | ||
"sk", | ||
"sl", | ||
"so", | ||
"sq", | ||
"sr", | ||
"sv", | ||
"ta", | ||
"tg", | ||
@@ -74,3 +85,5 @@ "th", | ||
"tr", | ||
"tt", | ||
"uk", | ||
"ug", | ||
"ur", | ||
@@ -122,3 +135,3 @@ "uz", | ||
"test": "make test", | ||
"lint": "eslint '**/*.js'" | ||
"lint": "eslint **/*.js" | ||
}, | ||
@@ -125,0 +138,0 @@ "bugs": { |
@@ -51,2 +51,4 @@ [![Build Status](https://secure.travis-ci.org/michaelwittig/node-i18n-iso-countries.png)](http://travis-ci.org/michaelwittig/node-i18n-iso-countries) | ||
- `af`: Afrikaans | ||
- `am`: Amharic | ||
- `ar`: Arabic | ||
@@ -70,2 +72,3 @@ - `az`: Azerbaijani | ||
- `el`: Greek | ||
- `ha`: Hausa | ||
- `he`: Hebrew | ||
@@ -83,2 +86,3 @@ - `hi`: Hindi | ||
- `ko`: Korean | ||
- `ku`: Kurdish | ||
- `ky`: Kyrgyz | ||
@@ -88,2 +92,3 @@ - `lt`: Lithuanian | ||
- `mk`: Macedonian | ||
- `ml`: Malayalam | ||
- `mn`: Mongolian | ||
@@ -94,12 +99,21 @@ - `ms`: Malay | ||
- `nn`: Norwegian Nynorsk | ||
- `no`: Norwegian | ||
- `pl`: Polish | ||
- `ps`: Pashto | ||
- `pt`: Portuguese | ||
- `ro`: Romanian | ||
- `ru`: Russian | ||
- `sd`: Sindhi | ||
- `sk`: Slovak | ||
- `sl`: Slovene | ||
- `so`: Somali | ||
- `sq`: Albanian | ||
- `sr`: Serbian | ||
- `sv`: Swedish | ||
- `ta`: Tamil | ||
- `tg`: Tajik | ||
- `th`: Thai | ||
- `tr`: Turkish | ||
- `tt`: Tatar | ||
- `ug`: Uyghur | ||
- `uk`: Ukrainian | ||
@@ -106,0 +120,0 @@ - `ur`: Urdu |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
558947
81
19118
256