1.0.2 • Published 9 months ago

country-data-latest v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

Country Data Utility

A simple utility for accessing country data, including country names, phone codes, and other useful information. This package allows you to easily fetch a list of all countries or get detailed country data with phone numbers.

Installation

To use this package, first install it via npm:

npm install country-data-latest

Get all country

// get all countries

import { getAllCountries } from "country-data-latest";

const countryNames = getAllCountries();
console.log(countryNames);
// Output: ["Afghanistan", "Aland Islands", ...]

get all country with phone number

import { getAllCountriesWithPhone } from "country-data-latest";

const countriesWithPhone = getAllCountriesWithPhone();
console.log(countriesWithPhone);
// Output: [
//   { name: "Afghanistan", countryCode: "93" },
//   { name: "Aland Islands", countryCode: "358" },
//   ...
// ]

Get all countries with phone numbers and flags

import { getAllCountriesWithPhoneAndFlag } from "country-data-latest";

const countriesWithPhoneAndFlag = getAllCountriesWithPhoneAndFlag();

// Log the result
console.log(countriesWithPhoneAndFlag);

// Output:
// [
//   { name: "Afghanistan", phone_code: "93", flag: "🇦🇫" },
//   { name: "Aland Islands", phone_code: "358", flag: "🇦🇽" },
//   ...
// ]
1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago