country-code-lookup
Advanced tools
+110
-0
@@ -2674,2 +2674,112 @@ module.exports.byFips = function(code) { | ||
| internet: 'RS' | ||
| }, | ||
| { | ||
| continent: 'Americas', | ||
| region: 'West Indies', | ||
| country: 'Saint Barthélemy', | ||
| capital: 'Gustavia', | ||
| fips: 'TB', | ||
| iso2: 'BL', | ||
| iso3: 'BLM', | ||
| isoNo: '652', | ||
| internet: 'BL' | ||
| }, | ||
| { | ||
| continent: 'Europe', | ||
| region: 'South East Europe', | ||
| country: 'Montenegro', | ||
| capital: 'Podgorica', | ||
| fips: 'MJ', | ||
| iso2: 'ME', | ||
| iso3: 'MNE', | ||
| isoNo: '499', | ||
| internet: 'ME' | ||
| }, | ||
| { | ||
| continent: 'Europe', | ||
| region: 'Western Europe', | ||
| country: 'Jersey', | ||
| capital: 'Saint Helier', | ||
| fips: 'JE', | ||
| iso2: 'JE', | ||
| iso3: 'JEY', | ||
| isoNo: '832', | ||
| internet: 'JE' | ||
| }, | ||
| { | ||
| continent: 'Americas', | ||
| region: 'West Indies', | ||
| country: 'Curaçao', | ||
| capital: 'Willemstad', | ||
| fips: 'UC', | ||
| iso2: 'CW', | ||
| iso3: 'CUW', | ||
| isoNo: '531', | ||
| internet: 'CW' | ||
| }, | ||
| { | ||
| continent: 'Americas', | ||
| region: 'West Indies', | ||
| country: 'Saint Martin', | ||
| capital: 'Marigot', | ||
| fips: 'RN', | ||
| iso2: 'MF', | ||
| iso3: 'MAF', | ||
| isoNo: '663', | ||
| internet: 'MF' | ||
| }, | ||
| { | ||
| continent: 'Americas', | ||
| region: 'West Indies', | ||
| country: 'Sint Maarten', | ||
| capital: 'Philipsburg', | ||
| fips: 'NN', | ||
| iso2: 'SX', | ||
| iso3: 'SXM', | ||
| isoNo: '534', | ||
| internet: 'SX' | ||
| }, | ||
| { | ||
| continent: 'Asia', | ||
| region: 'South East Asia', | ||
| country: 'Timor-Leste', | ||
| capital: 'Dili', | ||
| fips: 'TT', | ||
| iso2: 'TL', | ||
| iso3: 'TLS', | ||
| isoNo: '626', | ||
| internet: 'TL' | ||
| }, | ||
| { | ||
| continent: 'Africa', | ||
| region: 'Northern Africa', | ||
| country: 'South Sudan', | ||
| capital: 'Juba', | ||
| fips: 'OD', | ||
| iso2: 'SS', | ||
| iso3: 'SSD', | ||
| isoNo: '728', | ||
| internet: 'SS' | ||
| }, | ||
| { | ||
| continent: 'Europe', | ||
| region: 'Northern Europe', | ||
| country: 'Åland Islands', | ||
| capital: 'Mariehamn', | ||
| fips: 'AX', | ||
| iso2: 'AX', | ||
| iso3: 'ALA', | ||
| isoNo: '248', | ||
| internet: 'AX' | ||
| }, | ||
| { | ||
| continent: 'Americas', | ||
| region: 'West Indies', | ||
| country: 'Bonaire', | ||
| capital: 'Kralendijk', | ||
| fips: 'BQ', | ||
| iso2: 'BQ', | ||
| iso3: 'BES', | ||
| isoNo: '535', | ||
| internet: 'BQ' | ||
| } | ||
@@ -2676,0 +2786,0 @@ ] |
+1
-1
| { | ||
| "name": "country-code-lookup", | ||
| "version": "0.0.12", | ||
| "version": "0.0.13", | ||
| "description": "Finds countries by various country codes", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+82
-84
@@ -1,99 +0,97 @@ | ||
| var countries = require('./index.js'); | ||
| var countries = require('./index.js') | ||
| describe('country code', function(){ | ||
| describe('country code', function() { | ||
| it('loads the countries into an array', function(done) { | ||
| if (countries.countries.length < 239) | ||
| return done( | ||
| 'not all countries loaded, found ' + countries.countries.length | ||
| ) | ||
| return done() | ||
| }) | ||
| it('loads the countries into an array', function(done){ | ||
| if (countries.countries.length < 239) return done('not all countries loaded, found ' + countries.countries.length); | ||
| return done(); | ||
| }); | ||
| it('finds countries by fips', function(done) { | ||
| var uk = countries.byFips('UK') | ||
| if (!uk) return done('no country') | ||
| if (uk.country !== 'United Kingdom') return done('wrong country') | ||
| if (uk.continent !== 'Europe') return done('wrong continent') | ||
| if (uk.region !== 'Western Europe') return done('wrong region') | ||
| if (uk.capital !== 'London') return done('wrong capital') | ||
| return done() | ||
| }) | ||
| it('finds countries by fips', function(done){ | ||
| var uk = countries.byFips('UK'); | ||
| if (!uk) return done('no country'); | ||
| if (uk.country !== 'United Kingdom') return done('wrong country'); | ||
| if (uk.continent !== 'Europe') return done('wrong continent'); | ||
| if (uk.region !== 'Western Europe') return done('wrong region'); | ||
| if (uk.capital !== 'London') return done('wrong capital'); | ||
| return done(); | ||
| }); | ||
| it('finds countries by iso 2', function(done) { | ||
| var uk = countries.byIso('GB') | ||
| if (!uk) return done('no country') | ||
| if (uk.country !== 'United Kingdom') return done('wrong country') | ||
| return done() | ||
| }) | ||
| it('finds countries by iso 2', function(done){ | ||
| var uk = countries.byIso('GB'); | ||
| if (!uk) return done('no country'); | ||
| if (uk.country !== 'United Kingdom') return done('wrong country'); | ||
| return done(); | ||
| }); | ||
| it('finds countries by iso 3', function(done) { | ||
| var uk = countries.byIso('GBR') | ||
| if (!uk) return done('no country') | ||
| if (uk.country !== 'United Kingdom') return done('wrong country') | ||
| return done() | ||
| }) | ||
| it('finds countries by iso 3', function(done){ | ||
| var uk = countries.byIso('GBR'); | ||
| if (!uk) return done('no country'); | ||
| if (uk.country !== 'United Kingdom') return done('wrong country'); | ||
| return done(); | ||
| }); | ||
| it('finds countries by iso number', function(done) { | ||
| var uk = countries.byIso(826) | ||
| if (!uk) return done('no country') | ||
| if (uk.country !== 'United Kingdom') return done('wrong country') | ||
| return done() | ||
| }) | ||
| it('finds countries by iso number', function(done){ | ||
| var uk = countries.byIso(826); | ||
| if (!uk) return done('no country'); | ||
| if (uk.country !== 'United Kingdom') return done('wrong country'); | ||
| return done(); | ||
| }); | ||
| it('finds countries by iso number as a string', function(done) { | ||
| var uk = countries.byIso('826') | ||
| if (!uk) return done('no country') | ||
| if (uk.country !== 'United Kingdom') return done('wrong country') | ||
| return done() | ||
| }) | ||
| it('finds countries by iso number as a string', function(done){ | ||
| var uk = countries.byIso('826'); | ||
| if (!uk) return done('no country'); | ||
| if (uk.country !== 'United Kingdom') return done('wrong country'); | ||
| return done(); | ||
| }); | ||
| it('finds countries by internet code', function(done) { | ||
| var uk = countries.byInternet('UK') | ||
| if (!uk) return done('no country') | ||
| if (uk.country !== 'United Kingdom') return done('wrong country') | ||
| return done() | ||
| }) | ||
| it('finds countries by internet code', function(done){ | ||
| var uk = countries.byInternet('UK'); | ||
| if (!uk) return done('no country'); | ||
| if (uk.country !== 'United Kingdom') return done('wrong country'); | ||
| return done(); | ||
| }); | ||
| it('finds countries by lower case fips', function(done) { | ||
| var uk = countries.byFips('uk') | ||
| if (!uk) return done('no country') | ||
| if (uk.country !== 'United Kingdom') return done('wrong country') | ||
| return done() | ||
| }) | ||
| it('finds countries by lower case fips', function(done){ | ||
| var uk = countries.byFips('uk'); | ||
| if (!uk) return done('no country'); | ||
| if (uk.country !== 'United Kingdom') return done('wrong country'); | ||
| return done(); | ||
| }); | ||
| it('throws an error if the iso code is invalid', function(done) { | ||
| try { | ||
| var uk = countries.byIso('foo bar baz') | ||
| return done('exception should be thrown') | ||
| } catch (e) { | ||
| return done() | ||
| } | ||
| }) | ||
| it('throws an error if the iso code is invalid', function(done){ | ||
| try { | ||
| var uk = countries.byIso('foo bar baz'); | ||
| return done('exception should be thrown'); | ||
| } catch (e){ | ||
| return done() | ||
| } | ||
| }); | ||
| it('returns null if no country is found', function(done) { | ||
| var uk = countries.byIso(23452) | ||
| if (uk === null) return done() | ||
| return done('country should be null') | ||
| }) | ||
| it('returns null if no country is found', function(done){ | ||
| var uk = countries.byIso(23452); | ||
| if (uk === null) return done(); | ||
| return done('country should be null'); | ||
| }); | ||
| it('Romania is now ROU', function(done) { | ||
| var romania = countries.byIso('ROM') | ||
| if (null !== romania) return done('Romania is no longer ROM') | ||
| var romania = countries.byIso('ROU') | ||
| if (null === romania) return done('Romania is now ROU') | ||
| done() | ||
| }) | ||
| it('Romania is now ROU', function(done){ | ||
| var romania = countries.byIso('ROM'); | ||
| if (null !== romania) return done('Romania is no longer ROM'); | ||
| it('Democratic Republic of Congo', function(done) { | ||
| var drcongo = countries.byIso('COD') | ||
| if (null == drcongo) return done('Democratic Republic of Congo is COD') | ||
| var romania = countries.byIso('ROU'); | ||
| if (null === romania) return done('Romania is now ROU'); | ||
| done(); | ||
| var drcongo = countries.byIso('CD') | ||
| if (null == drcongo) return done('Democratic Republic of Congo is CD') | ||
| }); | ||
| it('Democratic Republic of Congo', function(done){ | ||
| var drcongo = countries.byIso('COD'); | ||
| if (null == drcongo) return done('Democratic Republic of Congo is COD'); | ||
| var drcongo = countries.byIso('CD'); | ||
| if (null == drcongo) return done('Democratic Republic of Congo is CD'); | ||
| done(); | ||
| }); | ||
| }); | ||
| done() | ||
| }) | ||
| }) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
55924
3.96%2861
4.11%0
-100%