Node module variant of the Country API,you'll get data in JSON format
- 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)
//Using npm
npm install kountry
//Using yarn
yarn add kountry
- 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
- 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)