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

world-info

v1.1.1

Published

Npm library to fetch information about any country

Downloads

7

Readme

World Info

An NPM package which helps you get any information of any Country.

There are 2 modules in this package. Future functions/modules will be added based on usage and necessity.

The first module is the General module with the following functions:

getCapital - Fetches the capital given a Country as a string input.

getTimezones - Fetches the UTC timezones given a Country as a string input. Returns a promise.

getFlag - Fetches a SVG image given a Country as string input.

getCurrency - Fetches the Country's currency code, currency name and currency symbol given a Country as string input. Returns a json array.

The second module is the Holiday Calendar module with the following functions:

getCountryCode - Fetches the list of countries and the country_codes eligible to be used under this module along with the holiday_type.

getHolidaysForYear - Fetches a JSON object with a list of holidays for a given countryCode and year. The default holidayType is public_holiday.

getHolidaysForMonth - Fetches a JSON object with a list of holidays for a given countryCode, year and month. The default holidayType is public_holiday.

isPublicHoliday - Fetches JSON object with key isPublicHoliday and value true|false when given countryCode and date as input parameters.

isWorkDay - Fetches a JSON object with key isWorkDay and value true|false when given countryCode and date as input parameters.

Following are the input parameters description:

countryCode - ISO 3166-1 alpha-3 country code or ISO 3166-1 alpha-2 country code
holidayType -

  • all - all holiday types
  • public_holiday - public holidays
  • observance - observances, not a public holidays
  • school_holiday - school holidays
  • other_day - other important days e.g. Mother's day, Father's day etc
  • extra_working_day - extra working days. This day takes place mostly on Saturday or Sunday and is substituted for extra public holiday.
    date - Date in format dd-mm-yyyy

Installation Instructions

npm i world-info

How to use

var worldInfo = require('world-info')
worldInfo.getCapital('India')
worldInfo.getTimeZones('India').then(data => doWhateverWith(data))
worldInfo.getFlag('India').then(data => doWhateverWith(data))
worldInfo.getCurrency('India').then(data => doWhateverWith(data))
worldInfo.getHolidaysForMonth('gbr','2019','1').then(data=>doWhateverWith(data))