countries-state-light
v1.0.2
Published
Light Weight Package for fetching countries and state
Downloads
2
Maintainers
Readme
countries-state-light
Light Weight library for Country and State
Install
npm i countries-state-light
Docs
getCountryByCode(countryCode)
It accepts a valid CountryCode
eg: 'US'
and returns Country Details
type: json | ICountry
{
isoCode: "US",
name: "United States",
phonecode: "1",
flag: "🇺🇸"
}
getStateByCodeAndCountry(stateCode, countryCode)
It accepts a valid StateCode
eg: 'CA'
CountryCode
eg: 'US'
and returns State Details
type: json | ICountry
{
name: "California",
isoCode: "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',
isoCode: 'AZ',
countryCode: 'US',
},
];
getAllCountries
It returns all Countries
type: array of json | ICountry
[
{
isoCode: 'US',
name: 'United States',
phonecode: '1',
flag: '🇺🇸',
},
];
getAllStates
It returns all States
type: array of json | IState
[
{
name: 'Arizona',
isoCode: 'AZ',
countryCode: 'US',
},
];