country-code-lookup
Advanced tools
Comparing version 0.0.3 to 0.0.4
19
index.js
@@ -6,4 +6,4 @@ | ||
var path = require('path'); | ||
var data = require('fs').readFileSync(path.join(__dirname, 'country-codes.csv')).toString().split('\r\n'); | ||
var data = require('fs').readFileSync(path.join(__dirname, 'country-codes.csv')).toString().split('\n'); | ||
var headings = data[0].split(','); | ||
@@ -15,3 +15,3 @@ | ||
for (var j = 0; j < headings.length; j++){ | ||
country[headings[j]] = parts[j]; | ||
country[headings[j].trim()] = parts[j].trim(); | ||
} | ||
@@ -31,12 +31,12 @@ countries.push(country); | ||
if (!isNaN(parseInt(code))){ | ||
return search('isoNo', code.toString()); | ||
return search('isoNo', code.toString()); | ||
} | ||
if (code.length === 2){ | ||
return search('iso2', code.toUpperCase()); | ||
} | ||
return search('iso2', code.toUpperCase()); | ||
} | ||
if (code.length === 3){ | ||
return search('iso3', code.toUpperCase()); | ||
} | ||
return search('iso3', code.toUpperCase()); | ||
} | ||
@@ -58,2 +58,1 @@ throw new Error("cannot determine ISO code type"); | ||
} | ||
{ | ||
"name": "country-code-lookup", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Finds countries by various country codes", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,1 +1,3 @@ | ||
[![Build Status](https://travis-ci.org/richorama/country-code-lookup.svg?branch=master)](https://travis-ci.org/richorama/country-code-lookup) | ||
# Country Code Lookup | ||
@@ -56,2 +58,1 @@ | ||
MIT | ||
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
19427
6
58