A TypeScript library providing Algeria's wilayat and baladiyat data with utility classes for easy lookup, search, and integration in any JavaScript or TypeScript project.
npm install dz-wilayas-core
# or
yarn add dz-wilayas-coreimport { WilayasStore, Wilaya, Baladiya } from "dz-wilayas-core";
const store = new WilayasStore();
// Get all wilayas
const allWilayas: Wilaya[] = store.getAllWilayas();
// Get a wilaya by code
const algerWilaya = store.getWilayaByCode("16");
// Search wilayas by name
const searchResults = store.searchWilayaByName("Oran");
// Get all baladiyat for a wilaya
const algerBaladiyat: Baladiya[] = store.getBaladiyatByWilayaCode("16");
console.log(algerWilaya, algerBaladiyat);| Method | Description |
|---|---|
getAllWilayas(): Wilaya[] |
Returns all wilayas. |
getWilayaByCode(code: string): Wilaya | undefined |
Find a wilaya by its code. |
searchWilayaByName(name: string): Wilaya[] |
Search wilayas by name (case-insensitive). |
getBaladiyatByWilayaCode(code: string): Baladiya[] |
Get all baladiyat for a given wilaya code. |
- Wilaya object example:
interface Wilaya {
id: string;
code: string;
name: string;
ar_name: string;
}- Baladiya object example:
interface Baladiya {
id: string;
wilaya_id: string;
name: string;
ar_name: string;
}All data is preloaded from JSON and typed for TypeScript.
- Fully typed out-of-the-box.
- Provides
WilayaandBaladiyatypes. - Includes
.d.tsfiles for complete IDE autocompletion.
- Fork the repo
- Create your branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -am 'Add my feature') - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
- After your PR is merged, uncomment the Contributors block below and add yourself by replacing
<YourUsername>with your GitHub username.
|
ThaBugMaker |
- Data source: Wilaya-Of-Algeria by AbderrahmeneDZ and yamanidev
This project is licensed under the MIT License. See LICENSE for details.
Β© 2025 ThaBugMaker All rights reserved.