npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

get-all-country-info

v1.1.6

Published

--- This package provides the information related the countries.The following informations are: * Country name * Country capital * Country currency * Contient * Language * Currency * Flag

Downloads

680

Readme

Countries Information


This package provides the information related the countries.The following informations are:

  • Country name
  • Country capital
  • Country currency
  • Contient
  • Language
  • Currency
  • Flag

Demo

Demo link


Installation

npm i get-all-country-info


Usage

import {
  getAllCountriesNames,
  getAllCountriesCallingCode,
  getAllIsoCodes,
  getCountryInfo
} from "get-all-country-info";

console.log(getAllCountriesNames()) // get all countries name

console.log(getAllCountriesCallingCode()) // get all countries calling code

console.log(getAllIsoCodes()) // get all countries iso code

// To use getCountryInfo pass the following object as parameter

const paramObject = {
  methodType: keyword, // Required Keyword can be found in the Keywords table 
  attributes: empty or country name
}

getCountryInfo(paramObject)

// getCountryInfo function can be implemented in three ways

// 1. Put methodType = Keyword, attributes = empty or country name
// Output = Returns details depending upon the keyword provided in methodType for 
//          a particular country(if attributes value is non-empty) and for all 
//          countries (if attributes value is empty)

const options = {
  methodType: "COUNTRY_NAMES",
  attributes: ""
}
console.log(getCountryInfo(options)) // get all countries name

// 2. Put methodType = array of keywords, attributes = country name
// Output = Returns details depending upon the keyword provided in methodType for a
//          particular country
const options = {
  methodType: ["CONTINENT_NAME", "COUNTRY_CODE"],
  attributes: "India"
}
console.log(getCountryInfo(options)) // get continent and country code of the country

// 3. Put methodType = array of keywords, attributes = empty
// Output = Returns details depending upon the keyword provided in methodType for 
//          a particular country(if attributes value is non-empty) and for all 
//          countries (if attributes value is empty) 
const options = {
  methodType:  ["CONTINENT_NAME", "COUNTRY_CODE"],
  attributes: ""
}
console.log(getCountryInfo(options)) // get all countries code and continent name

// result will be in array format

Methods

| Method | Description | Output | --- | --- | --- | | getContinentName("India") | Return the continents of the coutries | "Asia" | | getCountryCode("India") | Return the codes of the coutries | "IN" | | getCountryTimeZone("Aruba") | Return the timezones of the coutries | ["America/Aruba"] | | getAllCountriesNames() | Return the names of the coutries | ["Andorra", "United Arab Emirates", ...] | | getAllCountriesLanguages() | Return the languages of the coutries | [{"name": "Aruba", "languages": [ "Dutch", "English","Papiamento", "Spanish"] }, { "name": "Afghanistan", "languages": [ "Balochi", "Dari", "Pashto", "Turkmenian", "Uzbek"]}] | | getAllIsoCodes() | Return the iso code of the coutries | ["AD", "AE", ..] | | getAllCountriesFlag() | Return the flags of coutries | ["🇦🇨", "🇦🇩" ..] | | getAllCountriesCallingCode() | Return the calling codes of the coutries | ["+93", "+358" ...] | | getAllCountriesCapitals() | Return the capitals of coutries |[{ "country": "Afghanistan", "capital": "Kabul" }, { "country": "Albania", "capital": "Tirana" }, ...] | | getCurrencybyCountryCode("USD") | Return the information about currency of particular country | {symbol: '$', name: 'US Dollar', symbol_native: '$', decimal_digits: 2, rounding: 0, code: 'USD', name_plural: 'US dollars'} | | getAllCountryStateNames() | Return the states of the coutries | [{"country": "Afghanistan", "states": [ "Badakhshan", "Badghis", "Baghlan", ...]}, {"country": "Albania", "states": ["Berat", "Dibres", "Durres",...]}] | | getCountryByCode("+91-7976411430") | Pass the mobile number with country code and it returns the country information | {"name": "India", "dial_code": "+91", "code": "IN" } | | getCountryInfo(paramObject) | const paramObject = {methodType: keyword, (keywords can be string or array, keyword values are: CONTINENT_NAME, COUNTRY_CODE, COUNTRY_TIME_ZONE, COUNTRY_NAMES, LANGUAGES, ISO_CODES, FLAG, CALLING_CODE, COUNTRY_CAPITALS, CURRENCY, COUNTRY_STATE_NAMES) attributes: empty or country name} | returns according to the parameters |