countries-state-light
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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',
	},
];

Package Sidebar

Install

npm i countries-state-light

Weekly Downloads

0

Version

1.0.2

License

GPL-3.0

Unpacked Size

975 kB

Total Files

25

Last publish

Collaborators

  • zaidahmed