Package Exports
- country-state-city-plus
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (country-state-city-plus) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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"
}