world-countries-capitals
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -15,11 +15,8 @@ let data = require('./data/data.json'); | ||
const getNRandomCountriesData = (count) => { | ||
let randomCountriesArray = []; | ||
let randomCountriesSet = new Set(); // to prevent duplicate countries | ||
while (randomCountriesArray.length < count) { | ||
while (randomCountriesSet.size < count) { | ||
let country = data[randomNum()]; | ||
if (!randomCountriesSet.has(country)) { | ||
randomCountriesArray.push(country); | ||
} | ||
randomCountriesSet.add(country); // adds a country to the Array | ||
} | ||
return randomCountriesArray; | ||
return Array.from(randomCountriesSet); // Returns the Array | ||
}; | ||
@@ -26,0 +23,0 @@ |
{ | ||
"name": "world-countries-capitals", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "A simple NPM package to get capitals, currency, native language etc. of all the countries in the world", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,5 +1,5 @@ | ||
#### Want to contribute to open source? check issues [here.](https://github.com/bhatvikrant/world-countries-capitals/issues) | ||
# world-countries-capitals | ||
#### Want to contribute to open source? check issues [here.](https://github.com/bhatvikrant/world-countries-capitals/issues) | ||
<!-- ![](https://img.shields.io/github/forks/bhatvikrant/world-countries-capitals?style=social) | ||
@@ -6,0 +6,0 @@ |
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
84981
1237