country-locale-map
Advanced tools
Comparing version 1.6.1 to 1.7.0
10
index.js
const fuzz = require('fuzzball'); | ||
function CLM() { | ||
var clm = {}; | ||
var countries = require('./countries.json'); | ||
var countries; | ||
console.log(process.env.CLM_MODE); | ||
if(process && process.env && process.env.CLM_MODE == 'INTL') { | ||
countries = require('./countries-intl.json'); | ||
} else { | ||
countries = require('./countries.json'); | ||
} | ||
var countryByAlpha2Code = {}; | ||
@@ -7,0 +15,0 @@ var countryByAlpha3Code = {}; |
{ | ||
"name": "country-locale-map", | ||
"version": "1.6.1", | ||
"version": "1.7.0", | ||
"description": "Provides mapping between country codes and provides default country locals. Includes optional fuzzy matching for country name.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,2 +12,6 @@ # Country Locale Map [![Build Status](https://travis-ci.com/atnmorrison/country-locale-map.svg?branch=master)](https://travis-ci.com/atnmorrison/country-locale-map) | ||
If you would like locales to be returned with - instead of_ you can set an environment variable | ||
CLM_MODE='INTL' in a .env file using [dotenv](https://www.npmjs.com/package/dotenv) just make sure that dotenv is required before requiring the country local map library | ||
## Functions | ||
@@ -14,0 +18,0 @@ |
/* eslint-env node, mocha */ | ||
const chai = require('chai'); | ||
const expect = chai.expect; | ||
process.env.CLM_MODE = undefined; | ||
delete require.cache[require.resolve('../index.js')]; | ||
const clm = require('../index.js'); | ||
@@ -229,2 +233,7 @@ | ||
it('getLocaleByName should return zh_CN if passed in China', function(){ | ||
let result = clm.getLocaleByName('China', true); | ||
expect(result).to.equal('zh_CN'); | ||
}); | ||
}) |
Sorry, the diff of this file is too big to display
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
179958
8
584
302
5