Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

world-countries-capitals

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

world-countries-capitals - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

6

data/tests/package-lock.json

@@ -125,5 +125,5 @@ {

"lodash": {
"version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
"version": "4.17.19",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ=="
},

@@ -130,0 +130,0 @@ "ms": {

{
"name": "world-countries-capitals",
"version": "3.1.0",
"version": "3.1.1",
"description": "A simple NPM package to get capitals, currency, native language, famous_for etc. of all the countries in the world",

@@ -41,2 +41,2 @@ "main": "index.js",

}
}
}

@@ -1,2 +0,2 @@

_Want to contribute to open source? Try solving our issues [here](https://github.com/bhatvikrant/world-countries-capitals/issues)_
_Want to *contribute* to open source? Try solving our issues [here](https://github.com/bhatvikrant/world-countries-capitals/issues)_

@@ -36,5 +36,40 @@ # world-countries-capitals

This section contains nt to *contribute* to open source? Try solving our issues [here](https://github.com/bhatvikrant/world-countries-capitals/issues)_
# world-countries-capitals
A simple [npm](https://www.npmjs.com/package/world-countries-capitals) package to get capital, currency, native language, etc. of all the countries in the world.
![world-countries-capitals](assets/world-countries-capitals.gif)
[Demo](https://codesandbox.io/s/wcc-demo-tux1b)
[Docs](https://bhatvikrant.github.io/world-countries-capitals/)
## Installation
[![npm install](http://img.shields.io/badge/npm-install-blue.svg?style=for-the-badge&logo=npm)](https://docs.npmjs.com/getting-started/installing-npm-packages-locally) [![Node.js](http://img.shields.io/badge/Node-JS-teal.svg?style=for-the-badge&logo=node.js)](https://nodejs.org/en/) [![Node.js](https://img.shields.io/npm/v/world-countries-capitals?logo=npm&label=world-countries-capitals&style=for-the-badge)](https://www.npmjs.com/package/world-countries-capitals)
`world-countries-capital` is a [Node.js](https://nodejs.org/en/) module, and can be installed using the npm package manager.
Ensure that you have Node.js and npm installed. If you don't have Node.js or npm, you can download and install it [here](https://nodejs.org/en/download/).
Installation is done using the **[`npm install`](https://docs.npmjs.com/getting-started/installing-npm-packages-locally)** command on the terminal if you are on Linux / MacOS or on Command Prompt if you are using Windows:
[![NPM](https://nodei.co/npm/world-countries-capitals.png?compact=true)](https://nodei.co/npm/world-countries-capitals/)
## Importing
Before you can start using this package in your project, you need to import it. It can be imported as follows:
```javascript
const wcc = require('world-countries-capitals');
```
## Usage
This section contains information about various functions that are currently supported.
- **getAllCountryDetails()** <br>
- `getAllCountryDetails()` <br>
This method returns an **array of objects** containing all countries, each containing **country**, **capital**, **currency**, **native_language**, **famous for**, **phone_code**, and its **flag**.

@@ -66,3 +101,3 @@

- **getAllCountries()** <br>
- `getAllCountries()` <br>
This method returns an **array** conatining the **names** of all countries.

@@ -80,4 +115,6 @@

```
---
- **getCountiesByLanguage(languageSpoken)** <br>
- `getCountriesByLanguage(languageSpoken)` <br>
This method returns an **array of objects**, each containing **country**, **capital**, **currency**, **native_language**, **famous_for**, **phone_code**, and **flag** sorted by the _languageSpoken_ passed in as a parameter.<br>

@@ -110,3 +147,5 @@ Response for getCountiesByLanguage('Hindi')

- **getCountryDetailsByName(countryName)** <br>
---
- `getCountryDetailsByName(countryName)` <br>
This method returns an **array of objects**, each containing **country**, **capital**, **currency**, **native_language**, **famous_for**, **phone_code**, and **flag** sorted by the _name of the country_ passed in as a parameter.<br>

@@ -129,3 +168,5 @@ Response for getCountryDetailsByName('india')

- **getCountryDetailsByCapital(capital)** <br>
---
- `getCountryDetailsByCapital(capital)` <br>
This method returns an **array of objects**, each containing **country**, **capital**, **currency**, **native_language**, **famous_for**, **phone_code**, and **flag** sorted by the _capital_ .<br>

@@ -148,3 +189,5 @@ Response for getCountryDetailsByCapital('delhi')

- **getRandomCountry()** <br>
---
- `getRandomCountry()` <br>
This method returns a random country everytime.

@@ -165,3 +208,5 @@

- **getNRandomCountriesData(n)** <br>
---
- `getNRandomCountriesData(n)` <br>
This method returns an array having **n** number of random country objects, each object containing **country**, **capital**, **currency**, **native_language**, **famous_for**, **phone_code**, and **flag**.<br>

@@ -202,3 +247,5 @@ Sample response for n = 3

- **getCountriesByFamousFor(famousThing)** <br>
---
- `getCountriesByFamousFor(famousThing)` <br>
This method returns an array of objects, each object containing **country**, **capital**, **currency**, **native_language**, **famouse_for**, **phone_code**, and **flag** sorted by the _famousThing_ passed as the parameter.<br>

@@ -266,8 +313,8 @@ Response for getCountriesByFamousFor('oil')

### Example Use Cases
Example Use Cases
======
#### Example #1
To fetch a random country.
> To fetch a `random` country.

@@ -279,6 +326,6 @@ ```javascript

```
---
### Example #2
To get `count` random countries.
> To get the `count` of random countries.

@@ -290,6 +337,6 @@ ```javascript

```
---
### Example #3
To fetch country by capital.
> To fetch a `country` by its capital.

@@ -304,5 +351,6 @@ ```javascript

---
### Example #4
Get details of a country with its name.
> Get the details of a `country` with its name.

@@ -317,5 +365,6 @@ ```javascript

---
### Example #5
Fetch the details of country, with language.
> Fetch the `details of country`, with language.

@@ -330,5 +379,6 @@ ```javascript

---
### Example #6
Fetch all countries' details.
> Fetch all `countries'` details.

@@ -340,6 +390,6 @@ ```javascript

```
---
### Example #7
Get all the names of all countries.
> Get all the `names` of all countries.

@@ -351,6 +401,6 @@ ```javascript

```
---
### Example #8
Get the details of all countries that are famous for '_something_'.
> Get the details of all `countries` that are famous for '_something_'.

@@ -362,3 +412,3 @@ ```javascript

```
---
## Demo

@@ -368,2 +418,3 @@

---
## Want to contribute to our project?

@@ -370,0 +421,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc