Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jayantur13/kountry
Node module variant of the Country API
https://github.com/jayantur13/kountry
api data jsdelivr kountry nodejs npm npm-module npm-package unpkg yarn
Last synced: 5 days ago
JSON representation
Node module variant of the Country API
- Host: GitHub
- URL: https://github.com/jayantur13/kountry
- Owner: jayantur13
- License: other
- Created: 2022-02-25T19:25:21.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-20T09:54:40.000Z (5 months ago)
- Last Synced: 2024-11-05T21:59:13.925Z (10 days ago)
- Topics: api, data, jsdelivr, kountry, nodejs, npm, npm-module, npm-package, unpkg, yarn
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/kountry
- Size: 84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Node module variant of the Country API,you'll get data in JSON format
# Features
* Get country data by providing country name
* Get country data by providing country isocode
* Get country data by providing country code
* Get country data by providing a country id (1-243)
* Get top countries according to GDP (ascending/descending order)
* Get top countries according to population (ascending/descending order)
* Sort all country data alphabetically (a-z/z-a)# Installation
```
//Using npm
npm install kountry//Using yarn
yarn add kountry
```# Available methods
* byName(countryName) : provide valid country name
* byIsoCode(isoCode) : provide valid country isocode
* byCountryCode(countryCode) : provide valid countryCode
* byId(countryId) : provide valid country id
* byGdp(sort,limit) : sort countries by Gdp
* byPopulation(sort,limit) : sort countries by population
* doAlphabetically(sort,limit) : sort countries alphabetically# Examples
* byName(countryName)
@param countryName [String] takes string and is case sensitive```
const kountry = require('kountry')
const country = kountry.byName('India')
console.log(country)
```* byPopulation(sort,limit)
@param sort [String] takes either 'asc' or 'desc' for ordering
@param limit [Number] Number must be between >= 4 and 10```
const kountry = require('kountry')
//Defaults to sort = 'asc' and limit is 4
const country = kountry.byPopulation()//Ascending order limit default is 4
const country = kountry.byPopulation(sort='asc',limit=4)//Descending order limit default is 4
const country = kountry.byPopulation(sort='desc',limit=4)//Ascending order limit 8
const country = kountry.byPopulation(sort='asc',limit=8)//Descending order limit 8
const country = kountry.byPopulation(sort='desc',limit=8)
console.log(country)
```>### You can get more documentation while using the method on hover
### Find more on the Kountry website
### Using this package in your project ? Want to get added here ? Drop a message. 👍
### You can make contributions without breaking changes.Please read the Code-Of-Conduct
### License MIT. Please, attribute me and this repo if you use it for any of your purpose
### Last Updated: 26-02-2022