country-data-latest

1.0.2 • Public • Published

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: "🇦🇽" },
//   ...
// ]

Package Sidebar

Install

npm i country-data-latest

Weekly Downloads

24

Version

1.0.2

License

ISC

Unpacked Size

335 kB

Total Files

4

Last publish

Collaborators

  • zayedhossain120