Skip to content

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).

License

Notifications You must be signed in to change notification settings

ogubuikeAlex/CountryRegionJS

Repository files navigation

CountryRegion A cascading dropdown for loading countries and associated states and local governments.

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).

image

Badges

MIT License

stable release version: version

Nuget package downloads: downloads

NPM downloads: 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 .

About

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).

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published