0.1.1 • Published 2 years ago
country-state-lite-v1 v0.1.1
country-state-lite-v1
Light Weight library for Country and State
Install
npm i country-state-lite-v1
Docs
getCountryByCode(countryCode)
It accepts a valid CountryCode
eg: 'US'
and returns Country Details
type: json | ICountry
{
name: "United States",
code: "US",
flag: "🇺🇸",
phonecode: "+1"
}
getStateByCodeAndCountry(stateCode, countryCode)
It accepts a valid StateCode
eg: 'CA'
CountryCode
eg: 'US'
and returns State Details
type: json | ICountry
{
name: "California",
code: "CA",
countrycode: "US",
}
getStatesOfCountry(countryCode)
It accepts a valid CountryCode
and returns all States as Array of JSON
type: array of json | IState
[
{
name: 'Arizona',
code: 'AZ',
countrycode: 'US',
},
];
getAllCountries
It returns all Countries
type: array of json | ICountry
[
{
name: 'United States',
code: 'US',
flag: '🇺🇸',
phonecode: '+1',
},
];
getAllStates
It returns all States
type: array of json | IState
[
{
name: 'Arizona',
code: 'AZ',
countrycode: 'US',
},
];