New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

world-locations

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

world-locations

A Node.js package to retrieve data about countries, states, and cities using JSON files.

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Country, State, and City Data

country-state-city-list is an NPM package that provides functions to retrieve data about countries, states, and cities using JSON files. It is a simple and convenient way to access this geographical information for use in your Node.js applications.

Installation

You can install this package using npm:

npm install country-state-city-data

Usage

const cscData = require('country-state-city-data');

// Get all countries
const allCountries = cscData.getAllCountries();

// Get states by countryId
const statesInCountry = cscData.getStatesByCountryId(countryId);

// Get cities by stateId
const citiesInState = cscData.getCitiesByStateId(stateId);

Functions:

getAllCountries() Returns an array of all countries.

getStatesByCountryId(countryId) Returns an array of states in a country specified by countryId.

getCitiesByStateId(stateId) Returns an array of cities in a state specified by stateId.

Keywords

world-locations

FAQs

Package last updated on 14 Sep 2023

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