🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

country-state-city-plus

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-state-city-plus

Library for fetching Country, its States and Cities forked from country-state-city

latest
Source
npmnpm
Version
1.1.1
Version published
Weekly downloads
3
-25%
Maintainers
1
Weekly downloads
 
Created
Source

country-state-city

Basic library for Country, State and City forked from

https://github.com/harpreetkhalsagtbit/country-state-city

Data taken from:

https://github.com/hiiamrohit/Countries-States-Cities-database

Install

npm i country-state-city-plus

Usage

Latest Release : v1.0.0 (First Major Version Release - Not backward compatible)

  • ES6 Module usage

    import csc from 'country-state-city'
    
    // Import Interfaces`
    import { ICountry, IState, ICity } from 'country-state-city'
    
  • AMD Module usage

    let csc = require('country-state-city').default
    

Docs

visit for the functions

https://github.com/harpreetkhalsagtbit/country-state-city/#readme

getCountryByName(name)

It accepts a valid CountryName and returns Country Details

type: json | ICountry

{
	"id": "4",
	"sortname": "AS",
	"name": "American Samoa",
	"phonecode": "1684"
}

getStateByName(name)

It accepts a valid StateName and returns State Details

type: json | ICountry

{
	"id": 4119,
	"name": "Midlands",
	"country_id": "246"
}

getCityByName(name)

It accepts a valid CityName and returns City Details

type: json | ICity

{
	"id": "3",
	"name": "Port Blair",
	"state_id": "1"
}

Keywords

Country

FAQs

Package last updated on 05 Mar 2020

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