country-code-lookup
Advanced tools
Comparing version 0.0.13 to 0.0.14
@@ -25,2 +25,6 @@ module.exports.byFips = function(code) { | ||
module.exports.byCountry = function(country) { | ||
return search('country', country) | ||
} | ||
function search(field, code) { | ||
@@ -27,0 +31,0 @@ for (var i = 0; i < countries.length; i++) { |
{ | ||
"name": "country-code-lookup", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "Finds countries by various country codes", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -37,2 +37,5 @@ [![Build Status](https://travis-ci.org/richorama/country-code-lookup.svg?branch=master)](https://travis-ci.org/richorama/country-code-lookup) | ||
// search by country name | ||
lookup.byCountry('United Kingdom'); | ||
// get an array of all countries | ||
@@ -39,0 +42,0 @@ lookup.countries |
10
test.js
@@ -43,2 +43,12 @@ var countries = require('./index.js') | ||
it('finds countries by country name', function(done) { | ||
var uk = countries.byCountry('United Kingdom') | ||
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 number as a string', function(done) { | ||
@@ -45,0 +55,0 @@ var uk = countries.byIso('826') |
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
57582
6
2873
65