world-countries-capitals
Advanced tools
Comparing version 1.5.0 to 1.5.1
29
index.js
@@ -24,2 +24,14 @@ let data = require("./data/data.json"); | ||
// Helper function | ||
// const getCountriesByField = (value, fieldName) => { | ||
// let resultArray = []; | ||
// value = value.toLowerCase(); | ||
// field = fieldName; | ||
// data.forEach((item) => { | ||
// item[field] = item[field].toLowerCase(); | ||
// if (item[field] && item[field].includes(value)) { | ||
// resultArray.push(item); | ||
// } | ||
// }); | ||
const getCountriesByObject = (value, obj) => { | ||
@@ -39,3 +51,17 @@ let resultArray = []; | ||
// Get details of a country by the capital name | ||
// // Get details of a country by the capital name | ||
// const getCountryDetailsByCapital = (capital) => { | ||
// return getCountriesByField(capital, 'capital'); | ||
// }; | ||
// // Get details of a country by the country name | ||
// const getCountryDetailsByName = (country) => { | ||
// return getCountriesByField(country, 'country'); | ||
// }; | ||
// // Get country details by the language spoken | ||
// const getCountiesByLanguage = (languageSpoken) => { | ||
// return getCountriesByField(languageSpoken, 'native_language'); | ||
const getCountryDetailsByCapital = capital => { | ||
@@ -53,2 +79,3 @@ return getCountriesByObject(capital, "capital"); | ||
return getCountriesByObject(languageSpoken, "native_language"); | ||
}; | ||
@@ -55,0 +82,0 @@ |
{ | ||
"name": "world-countries-capitals", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "A simple NPM package to get capitals, currency, native language, famous_for etc. of all the countries in the world", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
98817
1447