Skip to content

A TypeScript package that offers seamless access to comprehensive information about countries.

License

Notifications You must be signed in to change notification settings

saultharwat74/ts-country

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1241e9d Â· Nov 22, 2023

History

38 Commits
Sep 10, 2023
Sep 4, 2023
Sep 7, 2023
Nov 22, 2023
Sep 4, 2023
Sep 4, 2023
Sep 4, 2023
Sep 20, 2023
Sep 10, 2023
Sep 20, 2023
Sep 20, 2023
Sep 5, 2023
Sep 4, 2023
Sep 4, 2023

Repository files navigation

ts-country

It's a TypeScript package that offers seamless access to comprehensive information about countries

Installation

Using npm:

npm install ts-country

or using yarn:

yarn add ts-country

or using pnpm:

pnpm add ts-country

Usage

Function Description
getCountry Retrieves detailed information about a specific country.
getCurrency Provides currency codes for a given country code.
getLanguage Retrieves detailed language information for a specific country code.
getCapital Retrieves the capital cities of various countries.

getCountry

Retrieves detailed information about a specific country.

import { getCountry } from "ts-country";

const countryInfo = getCountry() // Returns {
//   capital: "Washington, D.C.",
//   currency: { USD: "USD  -> United States Dollar" },
//   continent: "North America",
//   languages: { en: { name: "English", native: "English" } },
//   name: "United States",
//   native: "United States",
//   phone: [1],
//   continents: ["North America"],
//   emoji: "🇺🇸",
//   timezone: "America/New_York",
//   gmtoffset: "UTC-05:00",
//   geonameId: 6252001
//   fipsCode: "US",
//   isoNumeric: "840",
//   currencySymbol: "$",,
//   area: 9372610,
//   governmentType: Federal republic,
//   coastline: 19.924
// }

getCurrency

Provides currency codes for a given country code.

import { getCurrency } from "ts-country";

const currencyCodes = getCurrency("US");

// Accessing USD currency code
const usdCode = currencyCodes.USD; // Returns "USD  -> United States Dollar"

getLanguage

Retrieves detailed language information for a specific country code.

import { getLanguage } from "ts-country";

const languageInfo = getLanguage("US");

// Accessing English language information
const englishInfo = languageInfo.en; // Returns { name: "English", native: "English" }

getCapital

Retrieves the capital cities of various countries.

import { getCapital } from "ts-country";


const capitals = getCapital();
// Accessing capital of the United States
const usCapital = capitals.US.capital; // Returns "Washington, D.C."

License

This project is licensed under the MIT License - see the LICENSE

Contributing

If you'd like to contribute, please fork the repository and create a pull request. We welcome improvements and bug fixes.

About

A TypeScript package that offers seamless access to comprehensive information about countries.

Resources

License

Stars

Watchers

Forks

Packages

No packages published