1.0.6 β€’ Published 1 year ago

country-info-package v1.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

country-info-package

npm version npm downloads

country-info-package is an npm package designed to provide detailed information about countries. It includes data such as country codes, names, flags, languages, and more, simplifying the process of accessing country-related information for developers.

Installation

To install the country-info-package npm package, use the following command:

npm install country-info-package

How To Use

import { getCountryInfo } from "country-info-package";

// Example usage

// By country code
const countryByCode = getCountryInfo("ZW");
console.log(countryByCode);

// By country title
const countryByTitle = getCountryInfo("Zimbabwe");
console.log(countryByTitle);

// By phone code
const countryByPhoneCode = getCountryInfo("+263");
console.log(countryByPhoneCode);

Example Output

The getCountryInfo function returns an object with detailed country information:

{
  "title": "Zimbabwe",
  "code": "ZW",
  "time_zone": "UTC+2",
  "currency": {
    "name": "Zimbabwean Dollar",
    "symbol": "$"
  },
  "languages": ["English", "Shona", "Sindebele"],
  "ISO_codes": {
    "numeric": "716",
    "alpha3": "ZWE"
  },
  "phone_code": "+263",
  "area_km2": 390757,
  "flag": "πŸ‡ΏπŸ‡²"
}

API

getCountryInfo(value)

Parameters:

value (string): The country code (e.g., 'ZW'),

country title (e.g., 'Zimbabwe'), or

phone code (e.g., '+263').

Returns:

An object with country information, including the flag, or an object with a message if the country is not found.

Dependencies:

country-flag-icons: Provides country flag icons.

License

This package is licensed under the ISC License.

Author

Rizwan Khan (Captain)

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago