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

kountry

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kountry

Get country's data like GDP,area,population,country code,isocode and name

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

Kountry

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

Keywords

FAQs

Package last updated on 26 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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