🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

country-data-latest

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

country-data-latest

Get all country details by using a small package

latest
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

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


Keywords

country

FAQs

Package last updated on 23 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts