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

country-data-query

v1.0.3

Published

Easy and powerful library for query complex country and regions data in simple and effective way by country code, currency code, dial code in various filters.

Downloads

26

Readme

country-data-query

Easy and powerful library for query complex country and regions data in simple and effective way by country code, currency code, dial code in various filters.

This is library offer to you and maintained by Inhank advanced technologies.

Disclaimer

All country's and region data gathered from https://github.com/country-regions/country-region-data. If any data have incorrect information in this library simply rise pull request.

Quick start

install and import

npm install country-data-query  //By npm or
yarn add country-data-query  // By yarn method

import countryDataQuery from 'country-data-query'; //es6 method or
const countryDataQuery = require('country-data-query'); //es5 method

Query data

Data can query by the method countryDataQuery(queryParams) and queryParams is just json object it will be constructed by in following ways.

  • List all countries

    {
      country: {}
    }
  • Get country by filters

    //type is must be in countrycode, dialcode and currencycode
    {country:{type:"countrycode",value:"IN"}} //or
    {country:{type:"dialcode",value:"+91"}} //or
    {country:{type:"currencycode",value:"INR"}}
  • List country all regions

    {
      country:{type:"countrycode",value:"IN"},
      region:{}
    }
  • Get country region by code

    countryDataQuery({
       country:{type:"countrycode",value:"IN"},
       region:{type:"code",value:"AP"}
    })

Data format

The data returned by this library in following pattern

Country data

[
  {
    dial_code: "+91",
    currency: {
      code: "INR",
      name: "Indian Rupee",
      symbol: "Rs",
    },
    name: "India",
    code: "IN",
  },
]

Region data

[
  {
    name: "Andhra Pradesh",
    code: "AP",
  },
]

Whats new

1.0.3 Released on Aug 11, 2021

  • Removed and updated wrong iso codes
  1. Telangana TS into TG
  2. Sikkim WK into SK
  • Merged Dadra and Nagar Haveli and Daman and Diu as single region in India.
  • Added Ladakh union territory.
  • References
  1. https://en.wikipedia.org/wiki/ISO_3166-2:IN
  2. https://en.wikipedia.org/wiki/States_and_union_territories_of_India

1.0.2

  • Removed critical bug of array cloning method that cause break the data object.
  • Updated china yuan sign.