countryregionjs
v1.1.4
Published
A cascading dropdown for loading countries and states and sub-states.CountryRegionJs is a simple-to-use library that provides you with the MOST COMPREHENSIVE cascading dropdown for loading countries, associated states and substates (local governments).
Downloads
90
Readme
CountryRegion
CountryRegionJs is a simple-to-use library that provides you with the MOST COMPREHENSIVE cascading dropdown for loading countries, associated states and substates (local governments).
Badges
stable release version:
Nuget package downloads:
NPM downloads:
Tech Stack
Vanilla Javascript, Jest, Axios
How Do I Get Started
Install CountryRegionJS
with npm
npm install CountryRegionJS
or with yarn
yarn add CountryRegionJS
Sample usage:
//import countryregionjs
import CountryRegion from "countryregionjs";
const countryRegion = new CountryRegion();
//sample ids
const countryId = 1;
const stateId = 1;
const substateId = 1;
//get all countries
const countries = await countryRegion.getCountries();
//get all statess
const states = await countryRegion.getStates(countryId);
//get all substates
const subStates = await countryRegion.getLGAs(countryId, stateId);
//get a country
const country = await countryRegion.getCountry(countryId);
//get a state
const id = 1;
const country = await countryRegion.getState(countryId, stateId);
//get a sub-state
const id = 1;
const country = await countryRegion.getLga(countryId, stateId, substateId);
Documentation
A comprehensive documentation is underway💥
Features
- Get all countries
- Get all states
- Get all local governments
- Get a country
- Get a state
- Get a local government
Testing
To run unit tests:
npm test
License
MIT Copyright 2023 OGUBUIKE ALEX
Contributing
Contributions are always welcome!
See contributing.md
for ways to get started
Code Of Conduct
Please adhere to this project's Code of Conduct .