-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (26 loc) · 1.01 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Import JSON data directly
import divisions from './data/divisions.json';
import districts from './data/districts.json';
import upazilas from './data/upazilas.json';
import unions from './data/unions.json';
import districtArea from './data/district-area.json';
// Function to get all divisions
export function getDivisions() {
return divisions;
}
// Function to get districts by division ID
export function getDistrictsByDivision(divisionId) {
return districts.filter(district => district.division_id === divisionId);
}
// Function to get upazilas by district ID
export function getUpazilasByDistrict(districtId) {
return upazilas.filter(upazila => upazila.district_id === districtId);
}
// Function to get unions by upazila ID
export function getUnionsByUpazila(upazilaId) {
return unions.filter(union => union.upazilla_id === upazilaId);
}
// Function to get areas by district ID
export function getAreasByDistrict(districtId) {
return districtArea.filter(area => area.district_id === districtId)[0].areas;
}