├── .gitignore
├── README.md
├── data
├── csv
│ ├── cities.csv
│ ├── districts.csv
│ ├── provinces.csv
│ └── villages.csv
└── json
│ ├── cities.json
│ ├── districts.json
│ ├── provinces.json
│ └── villages.json
├── dist
├── cities.d.ts
├── cities.js
├── districts.d.ts
├── districts.js
├── index.d.ts
├── index.js
├── provinces.d.ts
├── provinces.js
├── villages.d.ts
└── villages.js
├── package-lock.json
├── package.json
├── scripts
└── csv-to-json.ts
├── src
├── cities.ts
├── districts.ts
├── index.ts
├── provinces.ts
└── villages.ts
├── test-project
├── index.js
├── index.ts
├── package-lock.json
└── package.json
├── tsconfig.json
└── types
└── index.d.ts
/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | /docs
3 | /test-project/node_modules
4 | *.tgz
5 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # 🇮🇩 Indonesia NodeJS
4 |
5 | [](https://www.npmjs.com/package/indonesia-nodejs)
6 | [](https://packagephobia.com/result?p=indonesia-nodejs)
7 | [](https://npm-stat.com/charts.html?package=indonesia-nodejs)
8 | [](https://opensource.org/licenses/MIT)
9 | [](https://www.typescriptlang.org/)
10 | [](#-testing)
11 |
12 | **📍 Data Wilayah Indonesia Terlengkap & Terbaru**
13 |
14 | *Data terbaru 2025 sesuai Kepmendagri No. 300.2.2-2138 Tahun 2025, data daerah-daerah di Indonesia termasuk 38 provinsi, kabupaten/kota, kecamatan, dan desa/kelurahan*
15 |
16 | **🚀 Fast • 🔒 Type-Safe • 📦 Zero Dependencies • ✅ Fully Tested**
17 |
18 |
19 |
20 | ## 📋 Daftar Isi
21 |
22 | - [✨ Fitur](#-fitur)
23 | - [📦 Instalasi](#-instalasi)
24 | - [🚀 Penggunaan](#-penggunaan)
25 | - [Provinsi](#provinsi)
26 | - [Kabupaten/Kota](#kabupatenkota)
27 | - [Kecamatan](#kecamatan)
28 | - [Desa/Kelurahan](#desakelurahan)
29 | - [📊 Struktur Data](#-struktur-data)
30 | - [🧪 Testing](#-testing)
31 | - [⚡ Performance](#-performance)
32 | - [🛠️ Development](#️-development)
33 | - [🤝 Kontribusi](#-kontribusi)
34 | - [📄 Lisensi](#-lisensi)
35 |
36 | ## ✨ Fitur
37 |
38 | ### 🎯 **Data & Akurasi**
39 | - ✅ **Data Terlengkap**: 38 provinsi, 514 kabupaten/kota, 7.285 kecamatan, dan 83.762 desa/kelurahan
40 | - ✅ **Data Terbaru**: Berdasarkan Kepmendagri tahun 2025
41 | - ✅ **Validasi Data**: Semua data telah divalidasi dan diverifikasi
42 |
43 | ### 🔧 **Developer Experience**
44 | - ✅ **TypeScript Native**: Full type safety dengan TypeScript definitions
45 | - ✅ **Promise-based API**: Modern async/await support
46 | - ✅ **Zero Dependencies**: Tidak ada external dependencies
47 | - ✅ **Tree Shaking**: Import hanya fungsi yang dibutuhkan
48 |
49 | ### 🔍 **Pencarian & Filtering**
50 | - ✅ **Pencarian Fleksibel**: Berdasarkan kode atau nama (case-insensitive)
51 | - ✅ **Relasi Hierarkis**: Navigasi mudah antar tingkat wilayah
52 | - ✅ **Fuzzy Search**: Pencarian toleran terhadap typo
53 |
54 | ### ⚡ **Performance & Quality**
55 | - ✅ **Optimized**: Performa tinggi dengan memory usage minimal
56 | - ✅ **Fully Tested**: 100% test coverage dengan comprehensive test suite
57 | - ✅ **Production Ready**: Telah diuji dalam environment production
58 |
59 | ## 📦 Instalasi
60 |
61 | ```bash
62 | # Menggunakan npm
63 | npm install indonesia-nodejs
64 |
65 | # Menggunakan yarn
66 | yarn add indonesia-nodejs
67 |
68 | # Menggunakan bun
69 | bun add indonesia-nodejs
70 |
71 | # Menggunakan pnpm
72 | pnpm add indonesia-nodejs
73 | ```
74 |
75 | ## 🚀 Penggunaan
76 |
77 | ### Provinsi
78 |
79 | ```typescript
80 | import {
81 | getAllProvinces,
82 | getProvinceByCode,
83 | getProvinceByName
84 | } from 'indonesia-nodejs';
85 |
86 | // Mendapatkan semua provinsi
87 | const provinces = await getAllProvinces();
88 |
89 | // Mendapatkan provinsi berdasarkan kode
90 | const jakarta = await getProvinceByCode(31);
91 |
92 | // Mendapatkan provinsi berdasarkan nama (case-insensitive)
93 | const bali = await getProvinceByName('bali');
94 | ```
95 |
96 | ### Kabupaten/Kota
97 |
98 | ```typescript
99 | import {
100 | getAllRegencies,
101 | getCityByCode,
102 | getCityByName,
103 | getRegenciesOfProvinceCode,
104 | getRegenciesOfProvinceName
105 | } from 'indonesia-nodejs';
106 |
107 | // Mendapatkan semua kabupaten/kota
108 | const cities = await getAllRegencies();
109 |
110 | // Mendapatkan kabupaten/kota berdasarkan kode
111 | const bandung = await getCityByCode(3273);
112 |
113 | // Mendapatkan kabupaten/kota berdasarkan nama
114 | const surabaya = await getCityByName('surabaya');
115 |
116 | // Mendapatkan semua kabupaten/kota di provinsi tertentu (berdasarkan kode)
117 | const citiesInJakarta = await getRegenciesOfProvinceCode(31);
118 |
119 | // Mendapatkan semua kabupaten/kota di provinsi tertentu (berdasarkan nama)
120 | const citiesInJogja = await getRegenciesOfProvinceName('yogyakarta');
121 | ```
122 |
123 | ### Kecamatan
124 |
125 | ```typescript
126 | import {
127 | getAllDistricts,
128 | getDistrictByCode,
129 | getDistrictByName,
130 | getDistrictsOfCityCode,
131 | getDistrictsOfCityName
132 | } from 'indonesia-nodejs';
133 |
134 | // Mendapatkan semua kecamatan
135 | const districts = await getAllDistricts();
136 |
137 | // Mendapatkan kecamatan berdasarkan kode
138 | const kecamatan = await getDistrictByCode(327301);
139 |
140 | // Mendapatkan kecamatan berdasarkan nama
141 | const cilandak = await getDistrictByName('cilandak');
142 |
143 | // Mendapatkan semua kecamatan di kota tertentu (berdasarkan kode)
144 | const districtsInBandung = await getDistrictsOfCityCode('3273');
145 |
146 | // Mendapatkan semua kecamatan di kota tertentu (berdasarkan nama)
147 | const districtsInSurabaya = await getDistrictsOfCityName('surabaya');
148 | ```
149 |
150 | ### Desa/Kelurahan
151 |
152 | ```typescript
153 | import {
154 | getAllVillages,
155 | getVillageByCode,
156 | getVillageByName,
157 | getVillagesOfDistrictCode,
158 | getVillagesOfDistrictName
159 | } from 'indonesia-nodejs';
160 |
161 | // Mendapatkan semua desa/kelurahan
162 | const villages = await getAllVillages();
163 |
164 | // Mendapatkan desa/kelurahan berdasarkan kode
165 | const kelurahan = await getVillageByCode(3273011001);
166 |
167 | // Mendapatkan desa/kelurahan berdasarkan nama
168 | const pondokIndah = await getVillageByName('pondok indah');
169 |
170 | // Mendapatkan semua desa/kelurahan di kecamatan tertentu (berdasarkan kode)
171 | const villagesInDistrict = await getVillagesOfDistrictCode('327301');
172 |
173 | // Mendapatkan semua desa/kelurahan di kecamatan tertentu (berdasarkan nama)
174 | const villagesInCilandak = await getVillagesOfDistrictName('cilandak');
175 | ```
176 |
177 | ## 📊 Struktur Data
178 |
179 | ### Province (Provinsi)
180 |
181 | ```typescript
182 | interface Province {
183 | code: number; // Kode provinsi (contoh: 31)
184 | name: string; // Nama provinsi (contoh: "DKI Jakarta")
185 | }
186 | ```
187 |
188 | ### City (Kabupaten/Kota)
189 |
190 | ```typescript
191 | interface City {
192 | code: number; // Kode kabupaten/kota (contoh: 3171)
193 | province_code: number; // Kode provinsi (contoh: 31)
194 | name: string; // Nama kabupaten/kota (contoh: "Jakarta Pusat")
195 | }
196 | ```
197 |
198 | ### District (Kecamatan)
199 |
200 | ```typescript
201 | interface District {
202 | code: number; // Kode kecamatan (contoh: 317101)
203 | city_code: number; // Kode kabupaten/kota (contoh: 3171)
204 | name: string; // Nama kecamatan (contoh: "Tanah Abang")
205 | }
206 | ```
207 |
208 | ### Village (Desa/Kelurahan)
209 |
210 | ```typescript
211 | interface Village {
212 | code: number; // Kode desa/kelurahan (contoh: 3171011001)
213 | district_code: number; // Kode kecamatan (contoh: 317101)
214 | name: string; // Nama desa/kelurahan (contoh: "Gelora")
215 | postal_code: number; // Kode Pos (contoh: 96051)
216 | }
217 | ```
218 |
219 | ## 🧪 Testing
220 |
221 | Library ini dilengkapi dengan comprehensive test suite yang mencakup:
222 |
223 | ### ✅ **Test Coverage**
224 | - **100% Function Coverage**: Semua fungsi telah ditest
225 | - **Data Validation**: Validasi struktur dan integritas data
226 | - **Performance Testing**: Monitoring memory usage dan execution time
227 | - **Error Handling**: Test untuk berbagai skenario error
228 |
229 | ### 🚀 **Menjalankan Test**
230 |
231 | ```bash
232 | # Clone repository
233 | git clone https://github.com/dhank77/indonesia-nodejs.git
234 | cd indonesia-nodejs
235 |
236 | # Install dependencies
237 | npm install
238 |
239 | # Jalankan test suite
240 | cd test-project
241 | node index.js
242 |
243 | # Atau untuk TypeScript test
244 | ts-node index.ts
245 | ```
246 |
247 | ### 📊 **Test Results Example**
248 |
249 | ```
250 | 🧪 Indonesia NodeJS - Comprehensive Test Suite
251 | ==============================================
252 |
253 | ✅ Province Tests: 3/3 passed
254 | ✅ City/Regency Tests: 5/5 passed
255 | ✅ District Tests: 5/5 passed
256 | ✅ Village Tests: 5/5 passed
257 |
258 | 📊 Performance Metrics:
259 | - Total execution time: 45ms
260 | - Memory usage: 12.5MB
261 | - Average response time: 2.3ms
262 |
263 | 🎉 All tests passed! (18/18)
264 | ```
265 |
266 | ## ⚡ Performance
267 |
268 | ### 📈 **Benchmarks**
269 |
270 | | Operation | Avg Time | Memory Usage |
271 | |-----------|----------|-------------|
272 | | getAllProvinces() | 1.2ms | 0.8MB |
273 | | getProvinceByCode() | 0.3ms | 0.1MB |
274 | | getAllRegencies() | 8.5ms | 2.1MB |
275 | | getCityByCode() | 0.4ms | 0.1MB |
276 | | getAllDistricts() | 45ms | 12MB |
277 | | getDistrictByCode() | 0.5ms | 0.1MB |
278 | | getAllVillages() | 180ms | 45MB |
279 | | getVillageByCode() | 0.6ms | 0.1MB |
280 |
281 | ### 🎯 **Optimizations**
282 | - **Lazy Loading**: Data dimuat hanya saat dibutuhkan
283 | - **Memory Efficient**: Optimized data structures
284 | - **Fast Lookups**: Indexed search untuk performa maksimal
285 |
286 | ## 🛠️ Development
287 |
288 | ### 📁 **Project Structure**
289 |
290 | ```
291 | indonesia-nodejs/
292 | ├── src/ # TypeScript source files
293 | ├── dist/ # Compiled JavaScript files
294 | ├── data/ # Raw data (JSON & CSV)
295 | ├── types/ # TypeScript definitions
296 | ├── test-project/ # Comprehensive test suite
297 | └── scripts/ # Build & utility scripts
298 | ```
299 |
300 | ### 🔧 **Build Process**
301 |
302 | ```bash
303 | # Install dependencies
304 | npm install
305 |
306 | # Build TypeScript to JavaScript
307 | npm run build
308 |
309 | # Generate type definitions
310 | npm run types
311 |
312 | # Run tests
313 | npm test
314 | ```
315 |
316 | ## 🤝 Kontribusi
317 |
318 | Kontribusi sangat diterima dan dihargai! Berikut cara berkontribusi:
319 |
320 | ### 🐛 **Melaporkan Bug**
321 | 1. Cek [existing issues](https://github.com/dhank77/indonesia-nodejs/issues) terlebih dahulu
322 | 2. Buat issue baru dengan template bug report
323 | 3. Sertakan informasi detail dan langkah reproduksi
324 |
325 | ### ✨ **Mengusulkan Fitur**
326 | 1. Buat issue dengan label "feature request"
327 | 2. Jelaskan use case dan manfaat fitur
328 | 3. Diskusikan implementasi dengan maintainer
329 |
330 | ### 🔧 **Pull Request**
331 | 1. Fork repository
332 | 2. Buat branch untuk fitur/fix: `git checkout -b feature/nama-fitur`
333 | 3. Commit perubahan: `git commit -m 'Add: fitur baru'`
334 | 4. Push ke branch: `git push origin feature/nama-fitur`
335 | 5. Buat Pull Request
336 |
337 | ### 📋 **Guidelines**
338 | - Ikuti coding style yang ada
339 | - Tambahkan test untuk fitur baru
340 | - Update dokumentasi jika diperlukan
341 | - Pastikan semua test passing
342 |
343 | ## 📄 Lisensi
344 |
345 | Project ini dilisensikan di bawah [MIT License](https://opensource.org/licenses/MIT).
346 |
347 | ---
348 |
349 | ## 📌 **Sumber Data**
350 | - **Wilayah**
351 | - Data wilayah Indonesia 2025 berasal dari [Yonatan Yusak Lestari](https://github.com/yonatanyl) bisa lihat di [repo ini](https://github.com/yonatanyl/KODE-WILAYAH-KEPMENDAGRI-2025) yang bersumber langsung dari Kepmendagri 2025.
352 | - Data wilayah Indonesia sebelumnya (< 2025) berasal dari github/api yang saya sudah lupa untuk cantumkan jika merasa itu data anda dengan senang hati kontak saya di [linkedin](https://www.linkedin.com/in/m-hamdani-ilham-latjoro/) atau [email](mailto:d41113512@gmail.com) ataupun buat issue di repo ini.
353 | - **Kode Pos**
354 | - Kodepos.sql datanya dari [w3appdev](https://github.com/w3appdev) bisa lihat di [repo ini](https://github.com/w3appdev/kodepos), dengan sumber utama dari [nomor.net](https://nomor.net).
355 |
356 | ---
357 |
358 | ## 🙏 Acknowledgments
359 |
360 | - Terinspirasi dari kebutuhan developer Indonesia
361 | - Terima kasih untuk semua [contributors](https://github.com/dhank77/indonesia-nodejs/graphs/contributors)
362 |
363 | ## 📞 Support
364 |
365 | - 📧 Email: [d41113512@gmail.com](mailto:d41113512@gmail.com)
366 | - 🐛 Issues: [GitHub Issues](https://github.com/dhank77/indonesia-nodejs/issues)
367 | - 💬 Discussions: [GitHub Discussions](https://github.com/dhank77/indonesia-nodejs/discussions)
368 |
369 | ---
370 |
371 |
372 |
373 | **🇮🇩 Made with ❤️ for Indonesian Developers**
374 |
375 | Dibuat oleh [M. Hamdani Ilham Latjoro](https://github.com/dhank77)
376 |
377 | ⭐ **Jika project ini membantu, berikan star di GitHub!** ⭐
378 |
--------------------------------------------------------------------------------
/data/csv/cities.csv:
--------------------------------------------------------------------------------
1 | 1101,11,Kabupaten Aceh Selatan
2 | 1102,11,Kabupaten Aceh Tenggara
3 | 1103,11,Kabupaten Aceh Timur
4 | 1104,11,Kabupaten Aceh Tengah
5 | 1105,11,Kabupaten Aceh Barat
6 | 1106,11,Kabupaten Aceh Besar
7 | 1107,11,Kabupaten Pidie
8 | 1108,11,Kabupaten Aceh Utara
9 | 1109,11,Kabupaten Simeulue
10 | 1110,11,Kabupaten Aceh Singkil
11 | 1111,11,Kabupaten Bireuen
12 | 1112,11,Kabupaten Aceh Barat Daya
13 | 1113,11,Kabupaten Gayo Lues
14 | 1114,11,Kabupaten Aceh Jaya
15 | 1115,11,Kabupaten Nagan Raya
16 | 1116,11,Kabupaten Aceh Tamiang
17 | 1117,11,Kabupaten Bener Meriah
18 | 1118,11,Kabupaten Pidie Jaya
19 | 1171,11,Kota Banda Aceh
20 | 1172,11,Kota Sabang
21 | 1173,11,Kota Lhokseumawe
22 | 1174,11,Kota Langsa
23 | 1175,11,Kota Subulussalam
24 | 1201,12,Kabupaten Tapanuli Tengah
25 | 1202,12,Kabupaten Tapanuli Utara
26 | 1203,12,Kabupaten Tapanuli Selatan
27 | 1204,12,Kabupaten Nias
28 | 1205,12,Kabupaten Langkat
29 | 1206,12,Kabupaten Karo
30 | 1207,12,Kabupaten Deli Serdang
31 | 1208,12,Kabupaten Simalungun
32 | 1209,12,Kabupaten Asahan
33 | 1210,12,Kabupaten Labuhanbatu
34 | 1211,12,Kabupaten Dairi
35 | 1212,12,Kabupaten Toba
36 | 1213,12,Kabupaten Mandailing Natal
37 | 1214,12,Kabupaten Nias Selatan
38 | 1215,12,Kabupaten Pakpak Bharat
39 | 1216,12,Kabupaten Humbang Hasundutan
40 | 1217,12,Kabupaten Samosir
41 | 1218,12,Kabupaten Serdang Bedagai
42 | 1219,12,Kabupaten Batu Bara
43 | 1220,12,Kabupaten Padang Lawas Utara
44 | 1221,12,Kabupaten Padang Lawas
45 | 1222,12,Kabupaten Labuhanbatu Selatan
46 | 1223,12,Kabupaten Labuhanbatu Utara
47 | 1224,12,Kabupaten Nias Utara
48 | 1225,12,Kabupaten Nias Barat
49 | 1271,12,Kota Medan
50 | 1272,12,Kota Pematangsiantar
51 | 1273,12,Kota Sibolga
52 | 1274,12,Kota Tanjungbalai
53 | 1275,12,Kota Binjai
54 | 1276,12,Kota Tebing Tinggi
55 | 1277,12,Kota Padangsidimpuan
56 | 1278,12,Kota Gunungsitoli
57 | 1301,13,Kabupaten Pesisir Selatan
58 | 1302,13,Kabupaten Solok
59 | 1303,13,Kabupaten Sijunjung
60 | 1304,13,Kabupaten Tanah Datar
61 | 1305,13,Kabupaten Padang Pariaman
62 | 1306,13,Kabupaten Agam
63 | 1307,13,Kabupaten Lima Puluh Kota
64 | 1308,13,Kabupaten Pasaman
65 | 1309,13,Kabupaten Kepulauan Mentawai
66 | 1310,13,Kabupaten Dharmasraya
67 | 1311,13,Kabupaten Solok Selatan
68 | 1312,13,Kabupaten Pasaman Barat
69 | 1371,13,Kota Padang
70 | 1372,13,Kota Solok
71 | 1373,13,Kota Sawahlunto
72 | 1374,13,Kota Padang Panjang
73 | 1375,13,Kota Bukittinggi
74 | 1376,13,Kota Payakumbuh
75 | 1377,13,Kota Pariaman
76 | 1401,14,Kabupaten Kampar
77 | 1402,14,Kabupaten Indragiri Hulu
78 | 1403,14,Kabupaten Bengkalis
79 | 1404,14,Kabupaten Indragiri Hilir
80 | 1405,14,Kabupaten Pelalawan
81 | 1406,14,Kabupaten Rokan Hulu
82 | 1407,14,Kabupaten Rokan Hilir
83 | 1408,14,Kabupaten Siak
84 | 1409,14,Kabupaten Kuantan Singingi
85 | 1410,14,Kabupaten Kepulauan Meranti
86 | 1471,14,Kota Pekanbaru
87 | 1472,14,Kota Dumai
88 | 1501,15,Kabupaten Kerinci
89 | 1502,15,Kabupaten Merangin
90 | 1503,15,Kabupaten Sarolangun
91 | 1504,15,Kabupaten Batanghari
92 | 1505,15,Kabupaten Muaro Jambi
93 | 1506,15,Kabupaten Tanjung Jabung Barat
94 | 1507,15,Kabupaten Tanjung Jabung Timur
95 | 1508,15,Kabupaten Bungo
96 | 1509,15,Kabupaten Tebo
97 | 1571,15,Kota Jambi
98 | 1572,15,Kota Sungai Penuh
99 | 1601,16,Kabupaten Ogan Komering Ulu
100 | 1602,16,Kabupaten Ogan Komering Ilir
101 | 1603,16,Kabupaten Muara Enim
102 | 1604,16,Kabupaten Lahat
103 | 1605,16,Kabupaten Musi Rawas
104 | 1606,16,Kabupaten Musi Banyuasin
105 | 1607,16,Kabupaten Banyuasin
106 | 1608,16,Kabupaten Ogan Komering Ulu Timur
107 | 1609,16,Kabupaten Ogan Komering Ulu Selatan
108 | 1610,16,Kabupaten Ogan Ilir
109 | 1611,16,Kabupaten Empat Lawang
110 | 1612,16,Kabupaten Penukal Abab Lematang Ilir
111 | 1613,16,Kabupaten Musi Rawas Utara
112 | 1671,16,Kota Palembang
113 | 1672,16,Kota Pagar Alam
114 | 1673,16,Kota Lubuk Linggau
115 | 1674,16,Kota Prabumulih
116 | 1701,17,Kabupaten Bengkulu Selatan
117 | 1702,17,Kabupaten Rejang Lebong
118 | 1703,17,Kabupaten Bengkulu Utara
119 | 1704,17,Kabupaten Kaur
120 | 1705,17,Kabupaten Seluma
121 | 1706,17,Kabupaten Mukomuko
122 | 1707,17,Kabupaten Lebong
123 | 1708,17,Kabupaten Kepahiang
124 | 1709,17,Kabupaten Bengkulu Tengah
125 | 1771,17,Kota Bengkulu
126 | 1801,18,Kabupaten Lampung Selatan
127 | 1802,18,Kabupaten Lampung Tengah
128 | 1803,18,Kabupaten Lampung Utara
129 | 1804,18,Kabupaten Lampung Barat
130 | 1805,18,Kabupaten Tulang Bawang
131 | 1806,18,Kabupaten Tanggamus
132 | 1807,18,Kabupaten Lampung Timur
133 | 1808,18,Kabupaten Way Kanan
134 | 1809,18,Kabupaten Pesawaran
135 | 1810,18,Kabupaten Pringsewu
136 | 1811,18,Kabupaten Mesuji
137 | 1812,18,Kabupaten Tulang Bawang Barat
138 | 1813,18,Kabupaten Pesisir Barat
139 | 1871,18,Kota Bandar Lampung
140 | 1872,18,Kota Metro
141 | 1901,19,Kabupaten Bangka
142 | 1902,19,Kabupaten Belitung
143 | 1903,19,Kabupaten Bangka Selatan
144 | 1904,19,Kabupaten Bangka Tengah
145 | 1905,19,Kabupaten Bangka Barat
146 | 1906,19,Kabupaten Belitung Timur
147 | 1971,19,Kota Pangkal Pinang
148 | 2101,21,Kabupaten Bintan
149 | 2102,21,Kabupaten Karimun
150 | 2103,21,Kabupaten Natuna
151 | 2104,21,Kabupaten Lingga
152 | 2105,21,Kabupaten Kepulauan Anambas
153 | 2171,21,Kota Batam
154 | 2172,21,Kota Tanjung Pinang
155 | 3101,31,Kabupaten Administrasi Kepulauan Seribu
156 | 3171,31,Kota Administrasi Jakarta Pusat
157 | 3172,31,Kota Administrasi Jakarta Utara
158 | 3173,31,Kota Administrasi Jakarta Barat
159 | 3174,31,Kota Administrasi Jakarta Selatan
160 | 3175,31,Kota Administrasi Jakarta Timur
161 | 3201,32,Kabupaten Bogor
162 | 3202,32,Kabupaten Sukabumi
163 | 3203,32,Kabupaten Cianjur
164 | 3204,32,Kabupaten Bandung
165 | 3205,32,Kabupaten Garut
166 | 3206,32,Kabupaten Tasikmalaya
167 | 3207,32,Kabupaten Ciamis
168 | 3208,32,Kabupaten Kuningan
169 | 3209,32,Kabupaten Cirebon
170 | 3210,32,Kabupaten Majalengka
171 | 3211,32,Kabupaten Sumedang
172 | 3212,32,Kabupaten Indramayu
173 | 3213,32,Kabupaten Subang
174 | 3214,32,Kabupaten Purwakarta
175 | 3215,32,Kabupaten Karawang
176 | 3216,32,Kabupaten Bekasi
177 | 3217,32,Kabupaten Bandung Barat
178 | 3218,32,Kabupaten Pangandaran
179 | 3271,32,Kota Bogor
180 | 3272,32,Kota Sukabumi
181 | 3273,32,Kota Bandung
182 | 3274,32,Kota Cirebon
183 | 3275,32,Kota Bekasi
184 | 3276,32,Kota Depok
185 | 3277,32,Kota Cimahi
186 | 3278,32,Kota Tasikmalaya
187 | 3279,32,Kota Banjar
188 | 3301,33,Kabupaten Cilacap
189 | 3302,33,Kabupaten Banyumas
190 | 3303,33,Kabupaten Purbalingga
191 | 3304,33,Kabupaten Banjarnegara
192 | 3305,33,Kabupaten Kebumen
193 | 3306,33,Kabupaten Purworejo
194 | 3307,33,Kabupaten Wonosobo
195 | 3308,33,Kabupaten Magelang
196 | 3309,33,Kabupaten Boyolali
197 | 3310,33,Kabupaten Klaten
198 | 3311,33,Kabupaten Sukoharjo
199 | 3312,33,Kabupaten Wonogiri
200 | 3313,33,Kabupaten Karanganyar
201 | 3314,33,Kabupaten Sragen
202 | 3315,33,Kabupaten Grobogan
203 | 3316,33,Kabupaten Blora
204 | 3317,33,Kabupaten Rembang
205 | 3318,33,Kabupaten Pati
206 | 3319,33,Kabupaten Kudus
207 | 3320,33,Kabupaten Jepara
208 | 3321,33,Kabupaten Demak
209 | 3322,33,Kabupaten Semarang
210 | 3323,33,Kabupaten Temanggung
211 | 3324,33,Kabupaten Kendal
212 | 3325,33,Kabupaten Batang
213 | 3326,33,Kabupaten Pekalongan
214 | 3327,33,Kabupaten Pemalang
215 | 3328,33,Kabupaten Tegal
216 | 3329,33,Kabupaten Brebes
217 | 3371,33,Kota Magelang
218 | 3372,33,Kota Surakarta
219 | 3373,33,Kota Salatiga
220 | 3374,33,Kota Semarang
221 | 3375,33,Kota Pekalongan
222 | 3376,33,Kota Tegal
223 | 3401,34,Kabupaten Kulon Progo
224 | 3402,34,Kabupaten Bantul
225 | 3403,34,Kabupaten Gunungkidul
226 | 3404,34,Kabupaten Sleman
227 | 3471,34,Kota Yogyakarta
228 | 3501,35,Kabupaten Pacitan
229 | 3502,35,Kabupaten Ponorogo
230 | 3503,35,Kabupaten Trenggalek
231 | 3504,35,Kabupaten Tulungagung
232 | 3505,35,Kabupaten Blitar
233 | 3506,35,Kabupaten Kediri
234 | 3507,35,Kabupaten Malang
235 | 3508,35,Kabupaten Lumajang
236 | 3509,35,Kabupaten Jember
237 | 3510,35,Kabupaten Banyuwangi
238 | 3511,35,Kabupaten Bondowoso
239 | 3512,35,Kabupaten Situbondo
240 | 3513,35,Kabupaten Probolinggo
241 | 3514,35,Kabupaten Pasuruan
242 | 3515,35,Kabupaten Sidoarjo
243 | 3516,35,Kabupaten Mojokerto
244 | 3517,35,Kabupaten Jombang
245 | 3518,35,Kabupaten Nganjuk
246 | 3519,35,Kabupaten Madiun
247 | 3520,35,Kabupaten Magetan
248 | 3521,35,Kabupaten Ngawi
249 | 3522,35,Kabupaten Bojonegoro
250 | 3523,35,Kabupaten Tuban
251 | 3524,35,Kabupaten Lamongan
252 | 3525,35,Kabupaten Gresik
253 | 3526,35,Kabupaten Bangkalan
254 | 3527,35,Kabupaten Sampang
255 | 3528,35,Kabupaten Pamekasan
256 | 3529,35,Kabupaten Sumenep
257 | 3571,35,Kota Kediri
258 | 3572,35,Kota Blitar
259 | 3573,35,Kota Malang
260 | 3574,35,Kota Probolinggo
261 | 3575,35,Kota Pasuruan
262 | 3576,35,Kota Mojokerto
263 | 3577,35,Kota Madiun
264 | 3578,35,Kota Surabaya
265 | 3579,35,Kota Batu
266 | 3601,36,Kabupaten Pandeglang
267 | 3602,36,Kabupaten Lebak
268 | 3603,36,Kabupaten Tangerang
269 | 3604,36,Kabupaten Serang
270 | 3671,36,Kota Tangerang
271 | 3672,36,Kota Cilegon
272 | 3673,36,Kota Serang
273 | 3674,36,Kota Tangerang Selatan
274 | 5101,51,Kabupaten Jembrana
275 | 5102,51,Kabupaten Tabanan
276 | 5103,51,Kabupaten Badung
277 | 5104,51,Kabupaten Gianyar
278 | 5105,51,Kabupaten Klungkung
279 | 5106,51,Kabupaten Bangli
280 | 5107,51,Kabupaten Karangasem
281 | 5108,51,Kabupaten Buleleng
282 | 5171,51,Kota Denpasar
283 | 5201,52,Kabupaten Lombok Barat
284 | 5202,52,Kabupaten Lombok Tengah
285 | 5203,52,Kabupaten Lombok Timur
286 | 5204,52,Kabupaten Sumbawa
287 | 5205,52,Kabupaten Dompu
288 | 5206,52,Kabupaten Bima
289 | 5207,52,Kabupaten Sumbawa Barat
290 | 5208,52,Kabupaten Lombok Utara
291 | 5271,52,Kota Mataram
292 | 5272,52,Kota Bima
293 | 5301,53,Kabupaten Kupang
294 | 5302,53,Kab Timor Tengah Selatan
295 | 5303,53,Kabupaten Timor Tengah Utara
296 | 5304,53,Kabupaten Belu
297 | 5305,53,Kabupaten Alor
298 | 5306,53,Kabupaten Flores Timur
299 | 5307,53,Kabupaten Sikka
300 | 5308,53,Kabupaten Ende
301 | 5309,53,Kabupaten Ngada
302 | 5310,53,Kabupaten Manggarai
303 | 5311,53,Kabupaten Sumba Timur
304 | 5312,53,Kabupaten Sumba Barat
305 | 5313,53,Kabupaten Lembata
306 | 5314,53,Kabupaten Rote Ndao
307 | 5315,53,Kabupaten Manggarai Barat
308 | 5316,53,Kabupaten Nagekeo
309 | 5317,53,Kabupaten Sumba Tengah
310 | 5318,53,Kabupaten Sumba Barat Daya
311 | 5319,53,Kabupaten Manggarai Timur
312 | 5320,53,Kabupaten Sabu Raijua
313 | 5321,53,Kabupaten Malaka
314 | 5371,53,Kota Kupang
315 | 6101,61,Kabupaten Sambas
316 | 6102,61,Kabupaten Mempawah
317 | 6103,61,Kabupaten Sanggau
318 | 6104,61,Kabupaten Ketapang
319 | 6105,61,Kabupaten Sintang
320 | 6106,61,Kabupaten Kapuas Hulu
321 | 6107,61,Kabupaten Bengkayang
322 | 6108,61,Kabupaten Landak
323 | 6109,61,Kabupaten Sekadau
324 | 6110,61,Kabupaten Melawi
325 | 6111,61,Kabupaten Kayong Utara
326 | 6112,61,Kabupaten Kubu Raya
327 | 6171,61,Kota Pontianak
328 | 6172,61,Kota Singkawang
329 | 6201,62,Kabupaten Kotawaringin Barat
330 | 6202,62,Kabupaten Kotawaringin Timur
331 | 6203,62,Kabupaten Kapuas
332 | 6204,62,Kabupaten Barito Selatan
333 | 6205,62,Kabupaten Barito Utara
334 | 6206,62,Kabupaten Katingan
335 | 6207,62,Kabupaten Seruyan
336 | 6208,62,Kabupaten Sukamara
337 | 6209,62,Kabupaten Lamandau
338 | 6210,62,Kabupaten Gunung Mas
339 | 6211,62,Kabupaten Pulang Pisau
340 | 6212,62,Kabupaten Murung Raya
341 | 6213,62,Kabupaten Barito Timur
342 | 6271,62,Kota Palangkaraya
343 | 6301,63,Kabupaten Tanah Laut
344 | 6302,63,Kabupaten Kotabaru
345 | 6303,63,Kabupaten Banjar
346 | 6304,63,Kabupaten Barito Kuala
347 | 6305,63,Kabupaten Tapin
348 | 6306,63,Kabupaten Hulu Sungai Selatan
349 | 6307,63,Kabupaten Hulu Sungai Tengah
350 | 6308,63,Kabupaten Hulu Sungai Utara
351 | 6309,63,Kabupaten Tabalong
352 | 6310,63,Kabupaten Tanah Bumbu
353 | 6311,63,Kabupaten Balangan
354 | 6371,63,Kota Banjarmasin
355 | 6372,63,Kota Banjarbaru
356 | 6401,64,Kabupaten Paser
357 | 6402,64,Kabupaten Kutai Kartanegara
358 | 6403,64,Kabupaten Berau
359 | 6407,64,Kabupaten Kutai Barat
360 | 6408,64,Kabupaten Kutai Timur
361 | 6409,64,Kabupaten Penajam Paser Utara
362 | 6411,64,Kabupaten Mahakam Ulu
363 | 6471,64,Kota Balikpapan
364 | 6472,64,Kota Samarinda
365 | 6474,64,Kota Bontang
366 | 6501,65,Kabupaten Bulungan
367 | 6502,65,Kabupaten Malinau
368 | 6503,65,Kabupaten Nunukan
369 | 6504,65,Kabupaten Tana Tidung
370 | 6571,65,Kota Tarakan
371 | 7101,71,Kabupaten Bolaang Mongondow
372 | 7102,71,Kabupaten Minahasa
373 | 7103,71,Kabupaten Kepulauan Sangihe
374 | 7104,71,Kabupaten Kepulauan Talaud
375 | 7105,71,Kabupaten Minahasa Selatan
376 | 7106,71,Kabupaten Minahasa Utara
377 | 7107,71,Kabupaten Minahasa Tenggara
378 | 7108,71,Kabupaten Bolaang Mongondow Utara
379 | 7109,71,Kabupaten Kep. Siau Tagulandang Biaro
380 | 7110,71,Kabupaten Bolaang Mongondow Timur
381 | 7111,71,Kabupaten Bolaang Mongondow Selatan
382 | 7171,71,Kota Manado
383 | 7172,71,Kota Bitung
384 | 7173,71,Kota Tomohon
385 | 7174,71,Kota Kotamobagu
386 | 7201,72,Kabupaten Banggai
387 | 7202,72,Kabupaten Poso
388 | 7203,72,Kabupaten Donggala
389 | 7204,72,Kabupaten Toli-Toli
390 | 7205,72,Kabupaten Buol
391 | 7206,72,Kabupaten Morowali
392 | 7207,72,Kabupaten Banggai Kepulauan
393 | 7208,72,Kabupaten Parigi Moutong
394 | 7209,72,Kabupaten Tojo Una Una
395 | 7210,72,Kabupaten Sigi
396 | 7211,72,Kabupaten Banggai Laut
397 | 7212,72,Kabupaten Morowali Utara
398 | 7271,72,Kota Palu
399 | 7301,73,Kabupaten Kepulauan Selayar
400 | 7302,73,Kabupaten Bulukumba
401 | 7303,73,Kabupaten Bantaeng
402 | 7304,73,Kabupaten Jeneponto
403 | 7305,73,Kabupaten Takalar
404 | 7306,73,Kabupaten Gowa
405 | 7307,73,Kabupaten Sinjai
406 | 7308,73,Kabupaten Bone
407 | 7309,73,Kabupaten Maros
408 | 7310,73,Kabupaten Pangkajene dan Kepulauan
409 | 7311,73,Kabupaten Barru
410 | 7312,73,Kabupaten Soppeng
411 | 7313,73,Kabupaten Wajo
412 | 7314,73,Kabupaten Sidenreng Rappang
413 | 7315,73,Kabupaten Pinrang
414 | 7316,73,Kabupaten Enrekang
415 | 7317,73,Kabupaten Luwu
416 | 7318,73,Kabupaten Tana Toraja
417 | 7322,73,Kabupaten Luwu Utara
418 | 7324,73,Kabupaten Luwu Timur
419 | 7326,73,Kabupaten Toraja Utara
420 | 7371,73,Kota Makassar
421 | 7372,73,Kota Parepare
422 | 7373,73,Kota Palopo
423 | 7401,74,Kabupaten Kolaka
424 | 7402,74,Kabupaten Konawe
425 | 7403,74,Kabupaten Muna
426 | 7404,74,Kabupaten Buton
427 | 7405,74,Kabupaten Konawe Selatan
428 | 7406,74,Kabupaten Bombana
429 | 7407,74,Kabupaten Wakatobi
430 | 7408,74,Kabupaten Kolaka Utara
431 | 7409,74,Kabupaten Konawe Utara
432 | 7410,74,Kabupaten Buton Utara
433 | 7411,74,Kabupaten Kolaka Timur
434 | 7412,74,Kabupaten Konawe Kepulauan
435 | 7413,74,Kabupaten Muna Barat
436 | 7414,74,Kabupaten Buton Tengah
437 | 7415,74,Kabupaten Buton Selatan
438 | 7471,74,Kota Kendari
439 | 7472,74,Kota Bau Bau
440 | 7501,75,Kabupaten Gorontalo
441 | 7502,75,Kabupaten Boalemo
442 | 7503,75,Kabupaten Bone Bolango
443 | 7504,75,Kabupaten Pohuwato
444 | 7505,75,Kabupaten Gorontalo Utara
445 | 7571,75,Kota Gorontalo
446 | 7601,76,Kabupaten Pasangkayu
447 | 7602,76,Kabupaten Mamuju
448 | 7603,76,Kabupaten Mamasa
449 | 7604,76,Kabupaten Polewali Mandar
450 | 7605,76,Kabupaten Majene
451 | 7606,76,Kabupaten Mamuju Tengah
452 | 8101,81,Kabupaten Maluku Tengah
453 | 8102,81,Kabupaten Maluku Tenggara
454 | 8103,81,Kabupaten Kepulauan Tanimbar
455 | 8104,81,Kabupaten Buru
456 | 8105,81,Kabupaten Seram Bagian Timur
457 | 8106,81,Kabupaten Seram Bagian Barat
458 | 8107,81,Kabupaten Kepulauan Aru
459 | 8108,81,Kabupaten Maluku Barat Daya
460 | 8109,81,Kabupaten Buru Selatan
461 | 8171,81,Kota Ambon
462 | 8172,81,Kota Tual
463 | 8201,82,Kabupaten Halmahera Barat
464 | 8202,82,Kabupaten Halmahera Tengah
465 | 8203,82,Kabupaten Halmahera Utara
466 | 8204,82,Kabupaten Halmahera Selatan
467 | 8205,82,Kabupaten Kepulauan Sula
468 | 8206,82,Kabupaten Halmahera Timur
469 | 8207,82,Kabupaten Pulau Morotai
470 | 8208,82,Kabupaten Pulau Taliabu
471 | 8271,82,Kota Ternate
472 | 8272,82,Kota Tidore Kepulauan
473 | 9103,91,Kabupaten Jayapura
474 | 9105,91,Kabupaten Kepulauan Yapen
475 | 9106,91,Kabupaten Biak Numfor
476 | 9110,91,Kabupaten Sarmi
477 | 9111,91,Kabupaten Keerom
478 | 9115,91,Kabupaten Waropen
479 | 9119,91,Kabupaten Supiori
480 | 9120,91,Kabupaten Mamberamo Raya
481 | 9171,91,Kota Jayapura
482 | 9202,92,Kabupaten Manokwari
483 | 9203,92,Kabupaten Fak Fak
484 | 9206,92,Kabupaten Teluk Bintuni
485 | 9207,92,Kabupaten Teluk Wondama
486 | 9208,92,Kabupaten Kaimana
487 | 9211,92,Kabupaten Manokwari Selatan
488 | 9212,92,Kabupaten Pegunungan Arfak
489 | 9301,93,Kabupaten Merauke
490 | 9302,93,Kabupaten Boven Digoel
491 | 9303,93,Kabupaten Mappi
492 | 9304,93,Kabupaten Asmat
493 | 9401,94,Kabupaten Nabire
494 | 9402,94,Kabupaten Puncak Jaya
495 | 9403,94,Kabupaten Paniai
496 | 9404,94,Kabupaten Mimika
497 | 9405,94,Kabupaten Puncak
498 | 9406,94,Kabupaten Dogiyai
499 | 9407,94,Kabupaten Intan Jaya
500 | 9408,94,Kabupaten Deiyai
501 | 9501,95,Kabupaten Jayawijaya
502 | 9502,95,Kab Pegunungan Bintang
503 | 9503,95,Kabupaten Yahukimo
504 | 9504,95,Kabupaten Tolikara
505 | 9505,95,Kabupaten Mamberamo Tengah
506 | 9506,95,Kabupaten Yalimo
507 | 9507,95,Kabupaten Lanny Jaya
508 | 9508,95,Kabupaten Nduga
509 | 9601,96,Kabupaten Sorong
510 | 9602,96,Kabupaten Sorong Selatan
511 | 9603,96,Kabupaten Raja Ampat
512 | 9604,96,Kabupaten Tambrauw
513 | 9605,96,Kabupaten Maybrat
514 | 9671,96,Kota Sorong
515 |
--------------------------------------------------------------------------------
/data/csv/provinces.csv:
--------------------------------------------------------------------------------
1 | 11,Aceh
2 | 12,Sumatera Utara
3 | 13,Sumatera Barat
4 | 14,Riau
5 | 15,Jambi
6 | 16,Sumatera Selatan
7 | 17,Bengkulu
8 | 18,Lampung
9 | 19,Kepulauan Bangka Belitung
10 | 21,Kepulauan Riau
11 | 31,Daerah Khusus Ibukota Jakarta
12 | 32,Jawa Barat
13 | 33,Jawa Tengah
14 | 34,Daerah Istimewa Yogyakarta
15 | 35,Jawa Timur
16 | 36,Banten
17 | 51,Bali
18 | 52,Nusa Tenggara Barat
19 | 53,Nusa Tenggara Timur
20 | 61,Kalimantan Barat
21 | 62,Kalimantan Tengah
22 | 63,Kalimantan Selatan
23 | 64,Kalimantan Timur
24 | 65,Kalimantan Utara
25 | 71,Sulawesi Utara
26 | 72,Sulawesi Tengah
27 | 73,Sulawesi Selatan
28 | 74,Sulawesi Tenggara
29 | 75,Gorontalo
30 | 76,Sulawesi Barat
31 | 81,Maluku
32 | 82,Maluku Utara
33 | 91,Papua
34 | 92,Papua Barat
35 | 93,Papua Selatan
36 | 94,Papua Tengah
37 | 95,Papua Pegunungan
38 | 96,Papua Barat Daya
39 |
--------------------------------------------------------------------------------
/data/json/cities.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "code": "1101",
4 | "province_code": "11",
5 | "name": "Kabupaten Aceh Selatan"
6 | },
7 | {
8 | "code": "1102",
9 | "province_code": "11",
10 | "name": "Kabupaten Aceh Tenggara"
11 | },
12 | {
13 | "code": "1103",
14 | "province_code": "11",
15 | "name": "Kabupaten Aceh Timur"
16 | },
17 | {
18 | "code": "1104",
19 | "province_code": "11",
20 | "name": "Kabupaten Aceh Tengah"
21 | },
22 | {
23 | "code": "1105",
24 | "province_code": "11",
25 | "name": "Kabupaten Aceh Barat"
26 | },
27 | {
28 | "code": "1106",
29 | "province_code": "11",
30 | "name": "Kabupaten Aceh Besar"
31 | },
32 | {
33 | "code": "1107",
34 | "province_code": "11",
35 | "name": "Kabupaten Pidie"
36 | },
37 | {
38 | "code": "1108",
39 | "province_code": "11",
40 | "name": "Kabupaten Aceh Utara"
41 | },
42 | {
43 | "code": "1109",
44 | "province_code": "11",
45 | "name": "Kabupaten Simeulue"
46 | },
47 | {
48 | "code": "1110",
49 | "province_code": "11",
50 | "name": "Kabupaten Aceh Singkil"
51 | },
52 | {
53 | "code": "1111",
54 | "province_code": "11",
55 | "name": "Kabupaten Bireuen"
56 | },
57 | {
58 | "code": "1112",
59 | "province_code": "11",
60 | "name": "Kabupaten Aceh Barat Daya"
61 | },
62 | {
63 | "code": "1113",
64 | "province_code": "11",
65 | "name": "Kabupaten Gayo Lues"
66 | },
67 | {
68 | "code": "1114",
69 | "province_code": "11",
70 | "name": "Kabupaten Aceh Jaya"
71 | },
72 | {
73 | "code": "1115",
74 | "province_code": "11",
75 | "name": "Kabupaten Nagan Raya"
76 | },
77 | {
78 | "code": "1116",
79 | "province_code": "11",
80 | "name": "Kabupaten Aceh Tamiang"
81 | },
82 | {
83 | "code": "1117",
84 | "province_code": "11",
85 | "name": "Kabupaten Bener Meriah"
86 | },
87 | {
88 | "code": "1118",
89 | "province_code": "11",
90 | "name": "Kabupaten Pidie Jaya"
91 | },
92 | {
93 | "code": "1171",
94 | "province_code": "11",
95 | "name": "Kota Banda Aceh"
96 | },
97 | {
98 | "code": "1172",
99 | "province_code": "11",
100 | "name": "Kota Sabang"
101 | },
102 | {
103 | "code": "1173",
104 | "province_code": "11",
105 | "name": "Kota Lhokseumawe"
106 | },
107 | {
108 | "code": "1174",
109 | "province_code": "11",
110 | "name": "Kota Langsa"
111 | },
112 | {
113 | "code": "1175",
114 | "province_code": "11",
115 | "name": "Kota Subulussalam"
116 | },
117 | {
118 | "code": "1201",
119 | "province_code": "12",
120 | "name": "Kabupaten Tapanuli Tengah"
121 | },
122 | {
123 | "code": "1202",
124 | "province_code": "12",
125 | "name": "Kabupaten Tapanuli Utara"
126 | },
127 | {
128 | "code": "1203",
129 | "province_code": "12",
130 | "name": "Kabupaten Tapanuli Selatan"
131 | },
132 | {
133 | "code": "1204",
134 | "province_code": "12",
135 | "name": "Kabupaten Nias"
136 | },
137 | {
138 | "code": "1205",
139 | "province_code": "12",
140 | "name": "Kabupaten Langkat"
141 | },
142 | {
143 | "code": "1206",
144 | "province_code": "12",
145 | "name": "Kabupaten Karo"
146 | },
147 | {
148 | "code": "1207",
149 | "province_code": "12",
150 | "name": "Kabupaten Deli Serdang"
151 | },
152 | {
153 | "code": "1208",
154 | "province_code": "12",
155 | "name": "Kabupaten Simalungun"
156 | },
157 | {
158 | "code": "1209",
159 | "province_code": "12",
160 | "name": "Kabupaten Asahan"
161 | },
162 | {
163 | "code": "1210",
164 | "province_code": "12",
165 | "name": "Kabupaten Labuhanbatu"
166 | },
167 | {
168 | "code": "1211",
169 | "province_code": "12",
170 | "name": "Kabupaten Dairi"
171 | },
172 | {
173 | "code": "1212",
174 | "province_code": "12",
175 | "name": "Kabupaten Toba"
176 | },
177 | {
178 | "code": "1213",
179 | "province_code": "12",
180 | "name": "Kabupaten Mandailing Natal"
181 | },
182 | {
183 | "code": "1214",
184 | "province_code": "12",
185 | "name": "Kabupaten Nias Selatan"
186 | },
187 | {
188 | "code": "1215",
189 | "province_code": "12",
190 | "name": "Kabupaten Pakpak Bharat"
191 | },
192 | {
193 | "code": "1216",
194 | "province_code": "12",
195 | "name": "Kabupaten Humbang Hasundutan"
196 | },
197 | {
198 | "code": "1217",
199 | "province_code": "12",
200 | "name": "Kabupaten Samosir"
201 | },
202 | {
203 | "code": "1218",
204 | "province_code": "12",
205 | "name": "Kabupaten Serdang Bedagai"
206 | },
207 | {
208 | "code": "1219",
209 | "province_code": "12",
210 | "name": "Kabupaten Batu Bara"
211 | },
212 | {
213 | "code": "1220",
214 | "province_code": "12",
215 | "name": "Kabupaten Padang Lawas Utara"
216 | },
217 | {
218 | "code": "1221",
219 | "province_code": "12",
220 | "name": "Kabupaten Padang Lawas"
221 | },
222 | {
223 | "code": "1222",
224 | "province_code": "12",
225 | "name": "Kabupaten Labuhanbatu Selatan"
226 | },
227 | {
228 | "code": "1223",
229 | "province_code": "12",
230 | "name": "Kabupaten Labuhanbatu Utara"
231 | },
232 | {
233 | "code": "1224",
234 | "province_code": "12",
235 | "name": "Kabupaten Nias Utara"
236 | },
237 | {
238 | "code": "1225",
239 | "province_code": "12",
240 | "name": "Kabupaten Nias Barat"
241 | },
242 | {
243 | "code": "1271",
244 | "province_code": "12",
245 | "name": "Kota Medan"
246 | },
247 | {
248 | "code": "1272",
249 | "province_code": "12",
250 | "name": "Kota Pematangsiantar"
251 | },
252 | {
253 | "code": "1273",
254 | "province_code": "12",
255 | "name": "Kota Sibolga"
256 | },
257 | {
258 | "code": "1274",
259 | "province_code": "12",
260 | "name": "Kota Tanjungbalai"
261 | },
262 | {
263 | "code": "1275",
264 | "province_code": "12",
265 | "name": "Kota Binjai"
266 | },
267 | {
268 | "code": "1276",
269 | "province_code": "12",
270 | "name": "Kota Tebing Tinggi"
271 | },
272 | {
273 | "code": "1277",
274 | "province_code": "12",
275 | "name": "Kota Padangsidimpuan"
276 | },
277 | {
278 | "code": "1278",
279 | "province_code": "12",
280 | "name": "Kota Gunungsitoli"
281 | },
282 | {
283 | "code": "1301",
284 | "province_code": "13",
285 | "name": "Kabupaten Pesisir Selatan"
286 | },
287 | {
288 | "code": "1302",
289 | "province_code": "13",
290 | "name": "Kabupaten Solok"
291 | },
292 | {
293 | "code": "1303",
294 | "province_code": "13",
295 | "name": "Kabupaten Sijunjung"
296 | },
297 | {
298 | "code": "1304",
299 | "province_code": "13",
300 | "name": "Kabupaten Tanah Datar"
301 | },
302 | {
303 | "code": "1305",
304 | "province_code": "13",
305 | "name": "Kabupaten Padang Pariaman"
306 | },
307 | {
308 | "code": "1306",
309 | "province_code": "13",
310 | "name": "Kabupaten Agam"
311 | },
312 | {
313 | "code": "1307",
314 | "province_code": "13",
315 | "name": "Kabupaten Lima Puluh Kota"
316 | },
317 | {
318 | "code": "1308",
319 | "province_code": "13",
320 | "name": "Kabupaten Pasaman"
321 | },
322 | {
323 | "code": "1309",
324 | "province_code": "13",
325 | "name": "Kabupaten Kepulauan Mentawai"
326 | },
327 | {
328 | "code": "1310",
329 | "province_code": "13",
330 | "name": "Kabupaten Dharmasraya"
331 | },
332 | {
333 | "code": "1311",
334 | "province_code": "13",
335 | "name": "Kabupaten Solok Selatan"
336 | },
337 | {
338 | "code": "1312",
339 | "province_code": "13",
340 | "name": "Kabupaten Pasaman Barat"
341 | },
342 | {
343 | "code": "1371",
344 | "province_code": "13",
345 | "name": "Kota Padang"
346 | },
347 | {
348 | "code": "1372",
349 | "province_code": "13",
350 | "name": "Kota Solok"
351 | },
352 | {
353 | "code": "1373",
354 | "province_code": "13",
355 | "name": "Kota Sawahlunto"
356 | },
357 | {
358 | "code": "1374",
359 | "province_code": "13",
360 | "name": "Kota Padang Panjang"
361 | },
362 | {
363 | "code": "1375",
364 | "province_code": "13",
365 | "name": "Kota Bukittinggi"
366 | },
367 | {
368 | "code": "1376",
369 | "province_code": "13",
370 | "name": "Kota Payakumbuh"
371 | },
372 | {
373 | "code": "1377",
374 | "province_code": "13",
375 | "name": "Kota Pariaman"
376 | },
377 | {
378 | "code": "1401",
379 | "province_code": "14",
380 | "name": "Kabupaten Kampar"
381 | },
382 | {
383 | "code": "1402",
384 | "province_code": "14",
385 | "name": "Kabupaten Indragiri Hulu"
386 | },
387 | {
388 | "code": "1403",
389 | "province_code": "14",
390 | "name": "Kabupaten Bengkalis"
391 | },
392 | {
393 | "code": "1404",
394 | "province_code": "14",
395 | "name": "Kabupaten Indragiri Hilir"
396 | },
397 | {
398 | "code": "1405",
399 | "province_code": "14",
400 | "name": "Kabupaten Pelalawan"
401 | },
402 | {
403 | "code": "1406",
404 | "province_code": "14",
405 | "name": "Kabupaten Rokan Hulu"
406 | },
407 | {
408 | "code": "1407",
409 | "province_code": "14",
410 | "name": "Kabupaten Rokan Hilir"
411 | },
412 | {
413 | "code": "1408",
414 | "province_code": "14",
415 | "name": "Kabupaten Siak"
416 | },
417 | {
418 | "code": "1409",
419 | "province_code": "14",
420 | "name": "Kabupaten Kuantan Singingi"
421 | },
422 | {
423 | "code": "1410",
424 | "province_code": "14",
425 | "name": "Kabupaten Kepulauan Meranti"
426 | },
427 | {
428 | "code": "1471",
429 | "province_code": "14",
430 | "name": "Kota Pekanbaru"
431 | },
432 | {
433 | "code": "1472",
434 | "province_code": "14",
435 | "name": "Kota Dumai"
436 | },
437 | {
438 | "code": "1501",
439 | "province_code": "15",
440 | "name": "Kabupaten Kerinci"
441 | },
442 | {
443 | "code": "1502",
444 | "province_code": "15",
445 | "name": "Kabupaten Merangin"
446 | },
447 | {
448 | "code": "1503",
449 | "province_code": "15",
450 | "name": "Kabupaten Sarolangun"
451 | },
452 | {
453 | "code": "1504",
454 | "province_code": "15",
455 | "name": "Kabupaten Batanghari"
456 | },
457 | {
458 | "code": "1505",
459 | "province_code": "15",
460 | "name": "Kabupaten Muaro Jambi"
461 | },
462 | {
463 | "code": "1506",
464 | "province_code": "15",
465 | "name": "Kabupaten Tanjung Jabung Barat"
466 | },
467 | {
468 | "code": "1507",
469 | "province_code": "15",
470 | "name": "Kabupaten Tanjung Jabung Timur"
471 | },
472 | {
473 | "code": "1508",
474 | "province_code": "15",
475 | "name": "Kabupaten Bungo"
476 | },
477 | {
478 | "code": "1509",
479 | "province_code": "15",
480 | "name": "Kabupaten Tebo"
481 | },
482 | {
483 | "code": "1571",
484 | "province_code": "15",
485 | "name": "Kota Jambi"
486 | },
487 | {
488 | "code": "1572",
489 | "province_code": "15",
490 | "name": "Kota Sungai Penuh"
491 | },
492 | {
493 | "code": "1601",
494 | "province_code": "16",
495 | "name": "Kabupaten Ogan Komering Ulu"
496 | },
497 | {
498 | "code": "1602",
499 | "province_code": "16",
500 | "name": "Kabupaten Ogan Komering Ilir"
501 | },
502 | {
503 | "code": "1603",
504 | "province_code": "16",
505 | "name": "Kabupaten Muara Enim"
506 | },
507 | {
508 | "code": "1604",
509 | "province_code": "16",
510 | "name": "Kabupaten Lahat"
511 | },
512 | {
513 | "code": "1605",
514 | "province_code": "16",
515 | "name": "Kabupaten Musi Rawas"
516 | },
517 | {
518 | "code": "1606",
519 | "province_code": "16",
520 | "name": "Kabupaten Musi Banyuasin"
521 | },
522 | {
523 | "code": "1607",
524 | "province_code": "16",
525 | "name": "Kabupaten Banyuasin"
526 | },
527 | {
528 | "code": "1608",
529 | "province_code": "16",
530 | "name": "Kabupaten Ogan Komering Ulu Timur"
531 | },
532 | {
533 | "code": "1609",
534 | "province_code": "16",
535 | "name": "Kabupaten Ogan Komering Ulu Selatan"
536 | },
537 | {
538 | "code": "1610",
539 | "province_code": "16",
540 | "name": "Kabupaten Ogan Ilir"
541 | },
542 | {
543 | "code": "1611",
544 | "province_code": "16",
545 | "name": "Kabupaten Empat Lawang"
546 | },
547 | {
548 | "code": "1612",
549 | "province_code": "16",
550 | "name": "Kabupaten Penukal Abab Lematang Ilir"
551 | },
552 | {
553 | "code": "1613",
554 | "province_code": "16",
555 | "name": "Kabupaten Musi Rawas Utara"
556 | },
557 | {
558 | "code": "1671",
559 | "province_code": "16",
560 | "name": "Kota Palembang"
561 | },
562 | {
563 | "code": "1672",
564 | "province_code": "16",
565 | "name": "Kota Pagar Alam"
566 | },
567 | {
568 | "code": "1673",
569 | "province_code": "16",
570 | "name": "Kota Lubuk Linggau"
571 | },
572 | {
573 | "code": "1674",
574 | "province_code": "16",
575 | "name": "Kota Prabumulih"
576 | },
577 | {
578 | "code": "1701",
579 | "province_code": "17",
580 | "name": "Kabupaten Bengkulu Selatan"
581 | },
582 | {
583 | "code": "1702",
584 | "province_code": "17",
585 | "name": "Kabupaten Rejang Lebong"
586 | },
587 | {
588 | "code": "1703",
589 | "province_code": "17",
590 | "name": "Kabupaten Bengkulu Utara"
591 | },
592 | {
593 | "code": "1704",
594 | "province_code": "17",
595 | "name": "Kabupaten Kaur"
596 | },
597 | {
598 | "code": "1705",
599 | "province_code": "17",
600 | "name": "Kabupaten Seluma"
601 | },
602 | {
603 | "code": "1706",
604 | "province_code": "17",
605 | "name": "Kabupaten Mukomuko"
606 | },
607 | {
608 | "code": "1707",
609 | "province_code": "17",
610 | "name": "Kabupaten Lebong"
611 | },
612 | {
613 | "code": "1708",
614 | "province_code": "17",
615 | "name": "Kabupaten Kepahiang"
616 | },
617 | {
618 | "code": "1709",
619 | "province_code": "17",
620 | "name": "Kabupaten Bengkulu Tengah"
621 | },
622 | {
623 | "code": "1771",
624 | "province_code": "17",
625 | "name": "Kota Bengkulu"
626 | },
627 | {
628 | "code": "1801",
629 | "province_code": "18",
630 | "name": "Kabupaten Lampung Selatan"
631 | },
632 | {
633 | "code": "1802",
634 | "province_code": "18",
635 | "name": "Kabupaten Lampung Tengah"
636 | },
637 | {
638 | "code": "1803",
639 | "province_code": "18",
640 | "name": "Kabupaten Lampung Utara"
641 | },
642 | {
643 | "code": "1804",
644 | "province_code": "18",
645 | "name": "Kabupaten Lampung Barat"
646 | },
647 | {
648 | "code": "1805",
649 | "province_code": "18",
650 | "name": "Kabupaten Tulang Bawang"
651 | },
652 | {
653 | "code": "1806",
654 | "province_code": "18",
655 | "name": "Kabupaten Tanggamus"
656 | },
657 | {
658 | "code": "1807",
659 | "province_code": "18",
660 | "name": "Kabupaten Lampung Timur"
661 | },
662 | {
663 | "code": "1808",
664 | "province_code": "18",
665 | "name": "Kabupaten Way Kanan"
666 | },
667 | {
668 | "code": "1809",
669 | "province_code": "18",
670 | "name": "Kabupaten Pesawaran"
671 | },
672 | {
673 | "code": "1810",
674 | "province_code": "18",
675 | "name": "Kabupaten Pringsewu"
676 | },
677 | {
678 | "code": "1811",
679 | "province_code": "18",
680 | "name": "Kabupaten Mesuji"
681 | },
682 | {
683 | "code": "1812",
684 | "province_code": "18",
685 | "name": "Kabupaten Tulang Bawang Barat"
686 | },
687 | {
688 | "code": "1813",
689 | "province_code": "18",
690 | "name": "Kabupaten Pesisir Barat"
691 | },
692 | {
693 | "code": "1871",
694 | "province_code": "18",
695 | "name": "Kota Bandar Lampung"
696 | },
697 | {
698 | "code": "1872",
699 | "province_code": "18",
700 | "name": "Kota Metro"
701 | },
702 | {
703 | "code": "1901",
704 | "province_code": "19",
705 | "name": "Kabupaten Bangka"
706 | },
707 | {
708 | "code": "1902",
709 | "province_code": "19",
710 | "name": "Kabupaten Belitung"
711 | },
712 | {
713 | "code": "1903",
714 | "province_code": "19",
715 | "name": "Kabupaten Bangka Selatan"
716 | },
717 | {
718 | "code": "1904",
719 | "province_code": "19",
720 | "name": "Kabupaten Bangka Tengah"
721 | },
722 | {
723 | "code": "1905",
724 | "province_code": "19",
725 | "name": "Kabupaten Bangka Barat"
726 | },
727 | {
728 | "code": "1906",
729 | "province_code": "19",
730 | "name": "Kabupaten Belitung Timur"
731 | },
732 | {
733 | "code": "1971",
734 | "province_code": "19",
735 | "name": "Kota Pangkal Pinang"
736 | },
737 | {
738 | "code": "2101",
739 | "province_code": "21",
740 | "name": "Kabupaten Bintan"
741 | },
742 | {
743 | "code": "2102",
744 | "province_code": "21",
745 | "name": "Kabupaten Karimun"
746 | },
747 | {
748 | "code": "2103",
749 | "province_code": "21",
750 | "name": "Kabupaten Natuna"
751 | },
752 | {
753 | "code": "2104",
754 | "province_code": "21",
755 | "name": "Kabupaten Lingga"
756 | },
757 | {
758 | "code": "2105",
759 | "province_code": "21",
760 | "name": "Kabupaten Kepulauan Anambas"
761 | },
762 | {
763 | "code": "2171",
764 | "province_code": "21",
765 | "name": "Kota Batam"
766 | },
767 | {
768 | "code": "2172",
769 | "province_code": "21",
770 | "name": "Kota Tanjung Pinang"
771 | },
772 | {
773 | "code": "3101",
774 | "province_code": "31",
775 | "name": "Kabupaten Administrasi Kepulauan Seribu"
776 | },
777 | {
778 | "code": "3171",
779 | "province_code": "31",
780 | "name": "Kota Administrasi Jakarta Pusat"
781 | },
782 | {
783 | "code": "3172",
784 | "province_code": "31",
785 | "name": "Kota Administrasi Jakarta Utara"
786 | },
787 | {
788 | "code": "3173",
789 | "province_code": "31",
790 | "name": "Kota Administrasi Jakarta Barat"
791 | },
792 | {
793 | "code": "3174",
794 | "province_code": "31",
795 | "name": "Kota Administrasi Jakarta Selatan"
796 | },
797 | {
798 | "code": "3175",
799 | "province_code": "31",
800 | "name": "Kota Administrasi Jakarta Timur"
801 | },
802 | {
803 | "code": "3201",
804 | "province_code": "32",
805 | "name": "Kabupaten Bogor"
806 | },
807 | {
808 | "code": "3202",
809 | "province_code": "32",
810 | "name": "Kabupaten Sukabumi"
811 | },
812 | {
813 | "code": "3203",
814 | "province_code": "32",
815 | "name": "Kabupaten Cianjur"
816 | },
817 | {
818 | "code": "3204",
819 | "province_code": "32",
820 | "name": "Kabupaten Bandung"
821 | },
822 | {
823 | "code": "3205",
824 | "province_code": "32",
825 | "name": "Kabupaten Garut"
826 | },
827 | {
828 | "code": "3206",
829 | "province_code": "32",
830 | "name": "Kabupaten Tasikmalaya"
831 | },
832 | {
833 | "code": "3207",
834 | "province_code": "32",
835 | "name": "Kabupaten Ciamis"
836 | },
837 | {
838 | "code": "3208",
839 | "province_code": "32",
840 | "name": "Kabupaten Kuningan"
841 | },
842 | {
843 | "code": "3209",
844 | "province_code": "32",
845 | "name": "Kabupaten Cirebon"
846 | },
847 | {
848 | "code": "3210",
849 | "province_code": "32",
850 | "name": "Kabupaten Majalengka"
851 | },
852 | {
853 | "code": "3211",
854 | "province_code": "32",
855 | "name": "Kabupaten Sumedang"
856 | },
857 | {
858 | "code": "3212",
859 | "province_code": "32",
860 | "name": "Kabupaten Indramayu"
861 | },
862 | {
863 | "code": "3213",
864 | "province_code": "32",
865 | "name": "Kabupaten Subang"
866 | },
867 | {
868 | "code": "3214",
869 | "province_code": "32",
870 | "name": "Kabupaten Purwakarta"
871 | },
872 | {
873 | "code": "3215",
874 | "province_code": "32",
875 | "name": "Kabupaten Karawang"
876 | },
877 | {
878 | "code": "3216",
879 | "province_code": "32",
880 | "name": "Kabupaten Bekasi"
881 | },
882 | {
883 | "code": "3217",
884 | "province_code": "32",
885 | "name": "Kabupaten Bandung Barat"
886 | },
887 | {
888 | "code": "3218",
889 | "province_code": "32",
890 | "name": "Kabupaten Pangandaran"
891 | },
892 | {
893 | "code": "3271",
894 | "province_code": "32",
895 | "name": "Kota Bogor"
896 | },
897 | {
898 | "code": "3272",
899 | "province_code": "32",
900 | "name": "Kota Sukabumi"
901 | },
902 | {
903 | "code": "3273",
904 | "province_code": "32",
905 | "name": "Kota Bandung"
906 | },
907 | {
908 | "code": "3274",
909 | "province_code": "32",
910 | "name": "Kota Cirebon"
911 | },
912 | {
913 | "code": "3275",
914 | "province_code": "32",
915 | "name": "Kota Bekasi"
916 | },
917 | {
918 | "code": "3276",
919 | "province_code": "32",
920 | "name": "Kota Depok"
921 | },
922 | {
923 | "code": "3277",
924 | "province_code": "32",
925 | "name": "Kota Cimahi"
926 | },
927 | {
928 | "code": "3278",
929 | "province_code": "32",
930 | "name": "Kota Tasikmalaya"
931 | },
932 | {
933 | "code": "3279",
934 | "province_code": "32",
935 | "name": "Kota Banjar"
936 | },
937 | {
938 | "code": "3301",
939 | "province_code": "33",
940 | "name": "Kabupaten Cilacap"
941 | },
942 | {
943 | "code": "3302",
944 | "province_code": "33",
945 | "name": "Kabupaten Banyumas"
946 | },
947 | {
948 | "code": "3303",
949 | "province_code": "33",
950 | "name": "Kabupaten Purbalingga"
951 | },
952 | {
953 | "code": "3304",
954 | "province_code": "33",
955 | "name": "Kabupaten Banjarnegara"
956 | },
957 | {
958 | "code": "3305",
959 | "province_code": "33",
960 | "name": "Kabupaten Kebumen"
961 | },
962 | {
963 | "code": "3306",
964 | "province_code": "33",
965 | "name": "Kabupaten Purworejo"
966 | },
967 | {
968 | "code": "3307",
969 | "province_code": "33",
970 | "name": "Kabupaten Wonosobo"
971 | },
972 | {
973 | "code": "3308",
974 | "province_code": "33",
975 | "name": "Kabupaten Magelang"
976 | },
977 | {
978 | "code": "3309",
979 | "province_code": "33",
980 | "name": "Kabupaten Boyolali"
981 | },
982 | {
983 | "code": "3310",
984 | "province_code": "33",
985 | "name": "Kabupaten Klaten"
986 | },
987 | {
988 | "code": "3311",
989 | "province_code": "33",
990 | "name": "Kabupaten Sukoharjo"
991 | },
992 | {
993 | "code": "3312",
994 | "province_code": "33",
995 | "name": "Kabupaten Wonogiri"
996 | },
997 | {
998 | "code": "3313",
999 | "province_code": "33",
1000 | "name": "Kabupaten Karanganyar"
1001 | },
1002 | {
1003 | "code": "3314",
1004 | "province_code": "33",
1005 | "name": "Kabupaten Sragen"
1006 | },
1007 | {
1008 | "code": "3315",
1009 | "province_code": "33",
1010 | "name": "Kabupaten Grobogan"
1011 | },
1012 | {
1013 | "code": "3316",
1014 | "province_code": "33",
1015 | "name": "Kabupaten Blora"
1016 | },
1017 | {
1018 | "code": "3317",
1019 | "province_code": "33",
1020 | "name": "Kabupaten Rembang"
1021 | },
1022 | {
1023 | "code": "3318",
1024 | "province_code": "33",
1025 | "name": "Kabupaten Pati"
1026 | },
1027 | {
1028 | "code": "3319",
1029 | "province_code": "33",
1030 | "name": "Kabupaten Kudus"
1031 | },
1032 | {
1033 | "code": "3320",
1034 | "province_code": "33",
1035 | "name": "Kabupaten Jepara"
1036 | },
1037 | {
1038 | "code": "3321",
1039 | "province_code": "33",
1040 | "name": "Kabupaten Demak"
1041 | },
1042 | {
1043 | "code": "3322",
1044 | "province_code": "33",
1045 | "name": "Kabupaten Semarang"
1046 | },
1047 | {
1048 | "code": "3323",
1049 | "province_code": "33",
1050 | "name": "Kabupaten Temanggung"
1051 | },
1052 | {
1053 | "code": "3324",
1054 | "province_code": "33",
1055 | "name": "Kabupaten Kendal"
1056 | },
1057 | {
1058 | "code": "3325",
1059 | "province_code": "33",
1060 | "name": "Kabupaten Batang"
1061 | },
1062 | {
1063 | "code": "3326",
1064 | "province_code": "33",
1065 | "name": "Kabupaten Pekalongan"
1066 | },
1067 | {
1068 | "code": "3327",
1069 | "province_code": "33",
1070 | "name": "Kabupaten Pemalang"
1071 | },
1072 | {
1073 | "code": "3328",
1074 | "province_code": "33",
1075 | "name": "Kabupaten Tegal"
1076 | },
1077 | {
1078 | "code": "3329",
1079 | "province_code": "33",
1080 | "name": "Kabupaten Brebes"
1081 | },
1082 | {
1083 | "code": "3371",
1084 | "province_code": "33",
1085 | "name": "Kota Magelang"
1086 | },
1087 | {
1088 | "code": "3372",
1089 | "province_code": "33",
1090 | "name": "Kota Surakarta"
1091 | },
1092 | {
1093 | "code": "3373",
1094 | "province_code": "33",
1095 | "name": "Kota Salatiga"
1096 | },
1097 | {
1098 | "code": "3374",
1099 | "province_code": "33",
1100 | "name": "Kota Semarang"
1101 | },
1102 | {
1103 | "code": "3375",
1104 | "province_code": "33",
1105 | "name": "Kota Pekalongan"
1106 | },
1107 | {
1108 | "code": "3376",
1109 | "province_code": "33",
1110 | "name": "Kota Tegal"
1111 | },
1112 | {
1113 | "code": "3401",
1114 | "province_code": "34",
1115 | "name": "Kabupaten Kulon Progo"
1116 | },
1117 | {
1118 | "code": "3402",
1119 | "province_code": "34",
1120 | "name": "Kabupaten Bantul"
1121 | },
1122 | {
1123 | "code": "3403",
1124 | "province_code": "34",
1125 | "name": "Kabupaten Gunungkidul"
1126 | },
1127 | {
1128 | "code": "3404",
1129 | "province_code": "34",
1130 | "name": "Kabupaten Sleman"
1131 | },
1132 | {
1133 | "code": "3471",
1134 | "province_code": "34",
1135 | "name": "Kota Yogyakarta"
1136 | },
1137 | {
1138 | "code": "3501",
1139 | "province_code": "35",
1140 | "name": "Kabupaten Pacitan"
1141 | },
1142 | {
1143 | "code": "3502",
1144 | "province_code": "35",
1145 | "name": "Kabupaten Ponorogo"
1146 | },
1147 | {
1148 | "code": "3503",
1149 | "province_code": "35",
1150 | "name": "Kabupaten Trenggalek"
1151 | },
1152 | {
1153 | "code": "3504",
1154 | "province_code": "35",
1155 | "name": "Kabupaten Tulungagung"
1156 | },
1157 | {
1158 | "code": "3505",
1159 | "province_code": "35",
1160 | "name": "Kabupaten Blitar"
1161 | },
1162 | {
1163 | "code": "3506",
1164 | "province_code": "35",
1165 | "name": "Kabupaten Kediri"
1166 | },
1167 | {
1168 | "code": "3507",
1169 | "province_code": "35",
1170 | "name": "Kabupaten Malang"
1171 | },
1172 | {
1173 | "code": "3508",
1174 | "province_code": "35",
1175 | "name": "Kabupaten Lumajang"
1176 | },
1177 | {
1178 | "code": "3509",
1179 | "province_code": "35",
1180 | "name": "Kabupaten Jember"
1181 | },
1182 | {
1183 | "code": "3510",
1184 | "province_code": "35",
1185 | "name": "Kabupaten Banyuwangi"
1186 | },
1187 | {
1188 | "code": "3511",
1189 | "province_code": "35",
1190 | "name": "Kabupaten Bondowoso"
1191 | },
1192 | {
1193 | "code": "3512",
1194 | "province_code": "35",
1195 | "name": "Kabupaten Situbondo"
1196 | },
1197 | {
1198 | "code": "3513",
1199 | "province_code": "35",
1200 | "name": "Kabupaten Probolinggo"
1201 | },
1202 | {
1203 | "code": "3514",
1204 | "province_code": "35",
1205 | "name": "Kabupaten Pasuruan"
1206 | },
1207 | {
1208 | "code": "3515",
1209 | "province_code": "35",
1210 | "name": "Kabupaten Sidoarjo"
1211 | },
1212 | {
1213 | "code": "3516",
1214 | "province_code": "35",
1215 | "name": "Kabupaten Mojokerto"
1216 | },
1217 | {
1218 | "code": "3517",
1219 | "province_code": "35",
1220 | "name": "Kabupaten Jombang"
1221 | },
1222 | {
1223 | "code": "3518",
1224 | "province_code": "35",
1225 | "name": "Kabupaten Nganjuk"
1226 | },
1227 | {
1228 | "code": "3519",
1229 | "province_code": "35",
1230 | "name": "Kabupaten Madiun"
1231 | },
1232 | {
1233 | "code": "3520",
1234 | "province_code": "35",
1235 | "name": "Kabupaten Magetan"
1236 | },
1237 | {
1238 | "code": "3521",
1239 | "province_code": "35",
1240 | "name": "Kabupaten Ngawi"
1241 | },
1242 | {
1243 | "code": "3522",
1244 | "province_code": "35",
1245 | "name": "Kabupaten Bojonegoro"
1246 | },
1247 | {
1248 | "code": "3523",
1249 | "province_code": "35",
1250 | "name": "Kabupaten Tuban"
1251 | },
1252 | {
1253 | "code": "3524",
1254 | "province_code": "35",
1255 | "name": "Kabupaten Lamongan"
1256 | },
1257 | {
1258 | "code": "3525",
1259 | "province_code": "35",
1260 | "name": "Kabupaten Gresik"
1261 | },
1262 | {
1263 | "code": "3526",
1264 | "province_code": "35",
1265 | "name": "Kabupaten Bangkalan"
1266 | },
1267 | {
1268 | "code": "3527",
1269 | "province_code": "35",
1270 | "name": "Kabupaten Sampang"
1271 | },
1272 | {
1273 | "code": "3528",
1274 | "province_code": "35",
1275 | "name": "Kabupaten Pamekasan"
1276 | },
1277 | {
1278 | "code": "3529",
1279 | "province_code": "35",
1280 | "name": "Kabupaten Sumenep"
1281 | },
1282 | {
1283 | "code": "3571",
1284 | "province_code": "35",
1285 | "name": "Kota Kediri"
1286 | },
1287 | {
1288 | "code": "3572",
1289 | "province_code": "35",
1290 | "name": "Kota Blitar"
1291 | },
1292 | {
1293 | "code": "3573",
1294 | "province_code": "35",
1295 | "name": "Kota Malang"
1296 | },
1297 | {
1298 | "code": "3574",
1299 | "province_code": "35",
1300 | "name": "Kota Probolinggo"
1301 | },
1302 | {
1303 | "code": "3575",
1304 | "province_code": "35",
1305 | "name": "Kota Pasuruan"
1306 | },
1307 | {
1308 | "code": "3576",
1309 | "province_code": "35",
1310 | "name": "Kota Mojokerto"
1311 | },
1312 | {
1313 | "code": "3577",
1314 | "province_code": "35",
1315 | "name": "Kota Madiun"
1316 | },
1317 | {
1318 | "code": "3578",
1319 | "province_code": "35",
1320 | "name": "Kota Surabaya"
1321 | },
1322 | {
1323 | "code": "3579",
1324 | "province_code": "35",
1325 | "name": "Kota Batu"
1326 | },
1327 | {
1328 | "code": "3601",
1329 | "province_code": "36",
1330 | "name": "Kabupaten Pandeglang"
1331 | },
1332 | {
1333 | "code": "3602",
1334 | "province_code": "36",
1335 | "name": "Kabupaten Lebak"
1336 | },
1337 | {
1338 | "code": "3603",
1339 | "province_code": "36",
1340 | "name": "Kabupaten Tangerang"
1341 | },
1342 | {
1343 | "code": "3604",
1344 | "province_code": "36",
1345 | "name": "Kabupaten Serang"
1346 | },
1347 | {
1348 | "code": "3671",
1349 | "province_code": "36",
1350 | "name": "Kota Tangerang"
1351 | },
1352 | {
1353 | "code": "3672",
1354 | "province_code": "36",
1355 | "name": "Kota Cilegon"
1356 | },
1357 | {
1358 | "code": "3673",
1359 | "province_code": "36",
1360 | "name": "Kota Serang"
1361 | },
1362 | {
1363 | "code": "3674",
1364 | "province_code": "36",
1365 | "name": "Kota Tangerang Selatan"
1366 | },
1367 | {
1368 | "code": "5101",
1369 | "province_code": "51",
1370 | "name": "Kabupaten Jembrana"
1371 | },
1372 | {
1373 | "code": "5102",
1374 | "province_code": "51",
1375 | "name": "Kabupaten Tabanan"
1376 | },
1377 | {
1378 | "code": "5103",
1379 | "province_code": "51",
1380 | "name": "Kabupaten Badung"
1381 | },
1382 | {
1383 | "code": "5104",
1384 | "province_code": "51",
1385 | "name": "Kabupaten Gianyar"
1386 | },
1387 | {
1388 | "code": "5105",
1389 | "province_code": "51",
1390 | "name": "Kabupaten Klungkung"
1391 | },
1392 | {
1393 | "code": "5106",
1394 | "province_code": "51",
1395 | "name": "Kabupaten Bangli"
1396 | },
1397 | {
1398 | "code": "5107",
1399 | "province_code": "51",
1400 | "name": "Kabupaten Karangasem"
1401 | },
1402 | {
1403 | "code": "5108",
1404 | "province_code": "51",
1405 | "name": "Kabupaten Buleleng"
1406 | },
1407 | {
1408 | "code": "5171",
1409 | "province_code": "51",
1410 | "name": "Kota Denpasar"
1411 | },
1412 | {
1413 | "code": "5201",
1414 | "province_code": "52",
1415 | "name": "Kabupaten Lombok Barat"
1416 | },
1417 | {
1418 | "code": "5202",
1419 | "province_code": "52",
1420 | "name": "Kabupaten Lombok Tengah"
1421 | },
1422 | {
1423 | "code": "5203",
1424 | "province_code": "52",
1425 | "name": "Kabupaten Lombok Timur"
1426 | },
1427 | {
1428 | "code": "5204",
1429 | "province_code": "52",
1430 | "name": "Kabupaten Sumbawa"
1431 | },
1432 | {
1433 | "code": "5205",
1434 | "province_code": "52",
1435 | "name": "Kabupaten Dompu"
1436 | },
1437 | {
1438 | "code": "5206",
1439 | "province_code": "52",
1440 | "name": "Kabupaten Bima"
1441 | },
1442 | {
1443 | "code": "5207",
1444 | "province_code": "52",
1445 | "name": "Kabupaten Sumbawa Barat"
1446 | },
1447 | {
1448 | "code": "5208",
1449 | "province_code": "52",
1450 | "name": "Kabupaten Lombok Utara"
1451 | },
1452 | {
1453 | "code": "5271",
1454 | "province_code": "52",
1455 | "name": "Kota Mataram"
1456 | },
1457 | {
1458 | "code": "5272",
1459 | "province_code": "52",
1460 | "name": "Kota Bima"
1461 | },
1462 | {
1463 | "code": "5301",
1464 | "province_code": "53",
1465 | "name": "Kabupaten Kupang"
1466 | },
1467 | {
1468 | "code": "5302",
1469 | "province_code": "53",
1470 | "name": "Kab Timor Tengah Selatan"
1471 | },
1472 | {
1473 | "code": "5303",
1474 | "province_code": "53",
1475 | "name": "Kabupaten Timor Tengah Utara"
1476 | },
1477 | {
1478 | "code": "5304",
1479 | "province_code": "53",
1480 | "name": "Kabupaten Belu"
1481 | },
1482 | {
1483 | "code": "5305",
1484 | "province_code": "53",
1485 | "name": "Kabupaten Alor"
1486 | },
1487 | {
1488 | "code": "5306",
1489 | "province_code": "53",
1490 | "name": "Kabupaten Flores Timur"
1491 | },
1492 | {
1493 | "code": "5307",
1494 | "province_code": "53",
1495 | "name": "Kabupaten Sikka"
1496 | },
1497 | {
1498 | "code": "5308",
1499 | "province_code": "53",
1500 | "name": "Kabupaten Ende"
1501 | },
1502 | {
1503 | "code": "5309",
1504 | "province_code": "53",
1505 | "name": "Kabupaten Ngada"
1506 | },
1507 | {
1508 | "code": "5310",
1509 | "province_code": "53",
1510 | "name": "Kabupaten Manggarai"
1511 | },
1512 | {
1513 | "code": "5311",
1514 | "province_code": "53",
1515 | "name": "Kabupaten Sumba Timur"
1516 | },
1517 | {
1518 | "code": "5312",
1519 | "province_code": "53",
1520 | "name": "Kabupaten Sumba Barat"
1521 | },
1522 | {
1523 | "code": "5313",
1524 | "province_code": "53",
1525 | "name": "Kabupaten Lembata"
1526 | },
1527 | {
1528 | "code": "5314",
1529 | "province_code": "53",
1530 | "name": "Kabupaten Rote Ndao"
1531 | },
1532 | {
1533 | "code": "5315",
1534 | "province_code": "53",
1535 | "name": "Kabupaten Manggarai Barat"
1536 | },
1537 | {
1538 | "code": "5316",
1539 | "province_code": "53",
1540 | "name": "Kabupaten Nagekeo"
1541 | },
1542 | {
1543 | "code": "5317",
1544 | "province_code": "53",
1545 | "name": "Kabupaten Sumba Tengah"
1546 | },
1547 | {
1548 | "code": "5318",
1549 | "province_code": "53",
1550 | "name": "Kabupaten Sumba Barat Daya"
1551 | },
1552 | {
1553 | "code": "5319",
1554 | "province_code": "53",
1555 | "name": "Kabupaten Manggarai Timur"
1556 | },
1557 | {
1558 | "code": "5320",
1559 | "province_code": "53",
1560 | "name": "Kabupaten Sabu Raijua"
1561 | },
1562 | {
1563 | "code": "5321",
1564 | "province_code": "53",
1565 | "name": "Kabupaten Malaka"
1566 | },
1567 | {
1568 | "code": "5371",
1569 | "province_code": "53",
1570 | "name": "Kota Kupang"
1571 | },
1572 | {
1573 | "code": "6101",
1574 | "province_code": "61",
1575 | "name": "Kabupaten Sambas"
1576 | },
1577 | {
1578 | "code": "6102",
1579 | "province_code": "61",
1580 | "name": "Kabupaten Mempawah"
1581 | },
1582 | {
1583 | "code": "6103",
1584 | "province_code": "61",
1585 | "name": "Kabupaten Sanggau"
1586 | },
1587 | {
1588 | "code": "6104",
1589 | "province_code": "61",
1590 | "name": "Kabupaten Ketapang"
1591 | },
1592 | {
1593 | "code": "6105",
1594 | "province_code": "61",
1595 | "name": "Kabupaten Sintang"
1596 | },
1597 | {
1598 | "code": "6106",
1599 | "province_code": "61",
1600 | "name": "Kabupaten Kapuas Hulu"
1601 | },
1602 | {
1603 | "code": "6107",
1604 | "province_code": "61",
1605 | "name": "Kabupaten Bengkayang"
1606 | },
1607 | {
1608 | "code": "6108",
1609 | "province_code": "61",
1610 | "name": "Kabupaten Landak"
1611 | },
1612 | {
1613 | "code": "6109",
1614 | "province_code": "61",
1615 | "name": "Kabupaten Sekadau"
1616 | },
1617 | {
1618 | "code": "6110",
1619 | "province_code": "61",
1620 | "name": "Kabupaten Melawi"
1621 | },
1622 | {
1623 | "code": "6111",
1624 | "province_code": "61",
1625 | "name": "Kabupaten Kayong Utara"
1626 | },
1627 | {
1628 | "code": "6112",
1629 | "province_code": "61",
1630 | "name": "Kabupaten Kubu Raya"
1631 | },
1632 | {
1633 | "code": "6171",
1634 | "province_code": "61",
1635 | "name": "Kota Pontianak"
1636 | },
1637 | {
1638 | "code": "6172",
1639 | "province_code": "61",
1640 | "name": "Kota Singkawang"
1641 | },
1642 | {
1643 | "code": "6201",
1644 | "province_code": "62",
1645 | "name": "Kabupaten Kotawaringin Barat"
1646 | },
1647 | {
1648 | "code": "6202",
1649 | "province_code": "62",
1650 | "name": "Kabupaten Kotawaringin Timur"
1651 | },
1652 | {
1653 | "code": "6203",
1654 | "province_code": "62",
1655 | "name": "Kabupaten Kapuas"
1656 | },
1657 | {
1658 | "code": "6204",
1659 | "province_code": "62",
1660 | "name": "Kabupaten Barito Selatan"
1661 | },
1662 | {
1663 | "code": "6205",
1664 | "province_code": "62",
1665 | "name": "Kabupaten Barito Utara"
1666 | },
1667 | {
1668 | "code": "6206",
1669 | "province_code": "62",
1670 | "name": "Kabupaten Katingan"
1671 | },
1672 | {
1673 | "code": "6207",
1674 | "province_code": "62",
1675 | "name": "Kabupaten Seruyan"
1676 | },
1677 | {
1678 | "code": "6208",
1679 | "province_code": "62",
1680 | "name": "Kabupaten Sukamara"
1681 | },
1682 | {
1683 | "code": "6209",
1684 | "province_code": "62",
1685 | "name": "Kabupaten Lamandau"
1686 | },
1687 | {
1688 | "code": "6210",
1689 | "province_code": "62",
1690 | "name": "Kabupaten Gunung Mas"
1691 | },
1692 | {
1693 | "code": "6211",
1694 | "province_code": "62",
1695 | "name": "Kabupaten Pulang Pisau"
1696 | },
1697 | {
1698 | "code": "6212",
1699 | "province_code": "62",
1700 | "name": "Kabupaten Murung Raya"
1701 | },
1702 | {
1703 | "code": "6213",
1704 | "province_code": "62",
1705 | "name": "Kabupaten Barito Timur"
1706 | },
1707 | {
1708 | "code": "6271",
1709 | "province_code": "62",
1710 | "name": "Kota Palangkaraya"
1711 | },
1712 | {
1713 | "code": "6301",
1714 | "province_code": "63",
1715 | "name": "Kabupaten Tanah Laut"
1716 | },
1717 | {
1718 | "code": "6302",
1719 | "province_code": "63",
1720 | "name": "Kabupaten Kotabaru"
1721 | },
1722 | {
1723 | "code": "6303",
1724 | "province_code": "63",
1725 | "name": "Kabupaten Banjar"
1726 | },
1727 | {
1728 | "code": "6304",
1729 | "province_code": "63",
1730 | "name": "Kabupaten Barito Kuala"
1731 | },
1732 | {
1733 | "code": "6305",
1734 | "province_code": "63",
1735 | "name": "Kabupaten Tapin"
1736 | },
1737 | {
1738 | "code": "6306",
1739 | "province_code": "63",
1740 | "name": "Kabupaten Hulu Sungai Selatan"
1741 | },
1742 | {
1743 | "code": "6307",
1744 | "province_code": "63",
1745 | "name": "Kabupaten Hulu Sungai Tengah"
1746 | },
1747 | {
1748 | "code": "6308",
1749 | "province_code": "63",
1750 | "name": "Kabupaten Hulu Sungai Utara"
1751 | },
1752 | {
1753 | "code": "6309",
1754 | "province_code": "63",
1755 | "name": "Kabupaten Tabalong"
1756 | },
1757 | {
1758 | "code": "6310",
1759 | "province_code": "63",
1760 | "name": "Kabupaten Tanah Bumbu"
1761 | },
1762 | {
1763 | "code": "6311",
1764 | "province_code": "63",
1765 | "name": "Kabupaten Balangan"
1766 | },
1767 | {
1768 | "code": "6371",
1769 | "province_code": "63",
1770 | "name": "Kota Banjarmasin"
1771 | },
1772 | {
1773 | "code": "6372",
1774 | "province_code": "63",
1775 | "name": "Kota Banjarbaru"
1776 | },
1777 | {
1778 | "code": "6401",
1779 | "province_code": "64",
1780 | "name": "Kabupaten Paser"
1781 | },
1782 | {
1783 | "code": "6402",
1784 | "province_code": "64",
1785 | "name": "Kabupaten Kutai Kartanegara"
1786 | },
1787 | {
1788 | "code": "6403",
1789 | "province_code": "64",
1790 | "name": "Kabupaten Berau"
1791 | },
1792 | {
1793 | "code": "6407",
1794 | "province_code": "64",
1795 | "name": "Kabupaten Kutai Barat"
1796 | },
1797 | {
1798 | "code": "6408",
1799 | "province_code": "64",
1800 | "name": "Kabupaten Kutai Timur"
1801 | },
1802 | {
1803 | "code": "6409",
1804 | "province_code": "64",
1805 | "name": "Kabupaten Penajam Paser Utara"
1806 | },
1807 | {
1808 | "code": "6411",
1809 | "province_code": "64",
1810 | "name": "Kabupaten Mahakam Ulu"
1811 | },
1812 | {
1813 | "code": "6471",
1814 | "province_code": "64",
1815 | "name": "Kota Balikpapan"
1816 | },
1817 | {
1818 | "code": "6472",
1819 | "province_code": "64",
1820 | "name": "Kota Samarinda"
1821 | },
1822 | {
1823 | "code": "6474",
1824 | "province_code": "64",
1825 | "name": "Kota Bontang"
1826 | },
1827 | {
1828 | "code": "6501",
1829 | "province_code": "65",
1830 | "name": "Kabupaten Bulungan"
1831 | },
1832 | {
1833 | "code": "6502",
1834 | "province_code": "65",
1835 | "name": "Kabupaten Malinau"
1836 | },
1837 | {
1838 | "code": "6503",
1839 | "province_code": "65",
1840 | "name": "Kabupaten Nunukan"
1841 | },
1842 | {
1843 | "code": "6504",
1844 | "province_code": "65",
1845 | "name": "Kabupaten Tana Tidung"
1846 | },
1847 | {
1848 | "code": "6571",
1849 | "province_code": "65",
1850 | "name": "Kota Tarakan"
1851 | },
1852 | {
1853 | "code": "7101",
1854 | "province_code": "71",
1855 | "name": "Kabupaten Bolaang Mongondow"
1856 | },
1857 | {
1858 | "code": "7102",
1859 | "province_code": "71",
1860 | "name": "Kabupaten Minahasa"
1861 | },
1862 | {
1863 | "code": "7103",
1864 | "province_code": "71",
1865 | "name": "Kabupaten Kepulauan Sangihe"
1866 | },
1867 | {
1868 | "code": "7104",
1869 | "province_code": "71",
1870 | "name": "Kabupaten Kepulauan Talaud"
1871 | },
1872 | {
1873 | "code": "7105",
1874 | "province_code": "71",
1875 | "name": "Kabupaten Minahasa Selatan"
1876 | },
1877 | {
1878 | "code": "7106",
1879 | "province_code": "71",
1880 | "name": "Kabupaten Minahasa Utara"
1881 | },
1882 | {
1883 | "code": "7107",
1884 | "province_code": "71",
1885 | "name": "Kabupaten Minahasa Tenggara"
1886 | },
1887 | {
1888 | "code": "7108",
1889 | "province_code": "71",
1890 | "name": "Kabupaten Bolaang Mongondow Utara"
1891 | },
1892 | {
1893 | "code": "7109",
1894 | "province_code": "71",
1895 | "name": "Kabupaten Kep. Siau Tagulandang Biaro"
1896 | },
1897 | {
1898 | "code": "7110",
1899 | "province_code": "71",
1900 | "name": "Kabupaten Bolaang Mongondow Timur"
1901 | },
1902 | {
1903 | "code": "7111",
1904 | "province_code": "71",
1905 | "name": "Kabupaten Bolaang Mongondow Selatan"
1906 | },
1907 | {
1908 | "code": "7171",
1909 | "province_code": "71",
1910 | "name": "Kota Manado"
1911 | },
1912 | {
1913 | "code": "7172",
1914 | "province_code": "71",
1915 | "name": "Kota Bitung"
1916 | },
1917 | {
1918 | "code": "7173",
1919 | "province_code": "71",
1920 | "name": "Kota Tomohon"
1921 | },
1922 | {
1923 | "code": "7174",
1924 | "province_code": "71",
1925 | "name": "Kota Kotamobagu"
1926 | },
1927 | {
1928 | "code": "7201",
1929 | "province_code": "72",
1930 | "name": "Kabupaten Banggai"
1931 | },
1932 | {
1933 | "code": "7202",
1934 | "province_code": "72",
1935 | "name": "Kabupaten Poso"
1936 | },
1937 | {
1938 | "code": "7203",
1939 | "province_code": "72",
1940 | "name": "Kabupaten Donggala"
1941 | },
1942 | {
1943 | "code": "7204",
1944 | "province_code": "72",
1945 | "name": "Kabupaten Toli-Toli"
1946 | },
1947 | {
1948 | "code": "7205",
1949 | "province_code": "72",
1950 | "name": "Kabupaten Buol"
1951 | },
1952 | {
1953 | "code": "7206",
1954 | "province_code": "72",
1955 | "name": "Kabupaten Morowali"
1956 | },
1957 | {
1958 | "code": "7207",
1959 | "province_code": "72",
1960 | "name": "Kabupaten Banggai Kepulauan"
1961 | },
1962 | {
1963 | "code": "7208",
1964 | "province_code": "72",
1965 | "name": "Kabupaten Parigi Moutong"
1966 | },
1967 | {
1968 | "code": "7209",
1969 | "province_code": "72",
1970 | "name": "Kabupaten Tojo Una Una"
1971 | },
1972 | {
1973 | "code": "7210",
1974 | "province_code": "72",
1975 | "name": "Kabupaten Sigi"
1976 | },
1977 | {
1978 | "code": "7211",
1979 | "province_code": "72",
1980 | "name": "Kabupaten Banggai Laut"
1981 | },
1982 | {
1983 | "code": "7212",
1984 | "province_code": "72",
1985 | "name": "Kabupaten Morowali Utara"
1986 | },
1987 | {
1988 | "code": "7271",
1989 | "province_code": "72",
1990 | "name": "Kota Palu"
1991 | },
1992 | {
1993 | "code": "7301",
1994 | "province_code": "73",
1995 | "name": "Kabupaten Kepulauan Selayar"
1996 | },
1997 | {
1998 | "code": "7302",
1999 | "province_code": "73",
2000 | "name": "Kabupaten Bulukumba"
2001 | },
2002 | {
2003 | "code": "7303",
2004 | "province_code": "73",
2005 | "name": "Kabupaten Bantaeng"
2006 | },
2007 | {
2008 | "code": "7304",
2009 | "province_code": "73",
2010 | "name": "Kabupaten Jeneponto"
2011 | },
2012 | {
2013 | "code": "7305",
2014 | "province_code": "73",
2015 | "name": "Kabupaten Takalar"
2016 | },
2017 | {
2018 | "code": "7306",
2019 | "province_code": "73",
2020 | "name": "Kabupaten Gowa"
2021 | },
2022 | {
2023 | "code": "7307",
2024 | "province_code": "73",
2025 | "name": "Kabupaten Sinjai"
2026 | },
2027 | {
2028 | "code": "7308",
2029 | "province_code": "73",
2030 | "name": "Kabupaten Bone"
2031 | },
2032 | {
2033 | "code": "7309",
2034 | "province_code": "73",
2035 | "name": "Kabupaten Maros"
2036 | },
2037 | {
2038 | "code": "7310",
2039 | "province_code": "73",
2040 | "name": "Kabupaten Pangkajene dan Kepulauan"
2041 | },
2042 | {
2043 | "code": "7311",
2044 | "province_code": "73",
2045 | "name": "Kabupaten Barru"
2046 | },
2047 | {
2048 | "code": "7312",
2049 | "province_code": "73",
2050 | "name": "Kabupaten Soppeng"
2051 | },
2052 | {
2053 | "code": "7313",
2054 | "province_code": "73",
2055 | "name": "Kabupaten Wajo"
2056 | },
2057 | {
2058 | "code": "7314",
2059 | "province_code": "73",
2060 | "name": "Kabupaten Sidenreng Rappang"
2061 | },
2062 | {
2063 | "code": "7315",
2064 | "province_code": "73",
2065 | "name": "Kabupaten Pinrang"
2066 | },
2067 | {
2068 | "code": "7316",
2069 | "province_code": "73",
2070 | "name": "Kabupaten Enrekang"
2071 | },
2072 | {
2073 | "code": "7317",
2074 | "province_code": "73",
2075 | "name": "Kabupaten Luwu"
2076 | },
2077 | {
2078 | "code": "7318",
2079 | "province_code": "73",
2080 | "name": "Kabupaten Tana Toraja"
2081 | },
2082 | {
2083 | "code": "7322",
2084 | "province_code": "73",
2085 | "name": "Kabupaten Luwu Utara"
2086 | },
2087 | {
2088 | "code": "7324",
2089 | "province_code": "73",
2090 | "name": "Kabupaten Luwu Timur"
2091 | },
2092 | {
2093 | "code": "7326",
2094 | "province_code": "73",
2095 | "name": "Kabupaten Toraja Utara"
2096 | },
2097 | {
2098 | "code": "7371",
2099 | "province_code": "73",
2100 | "name": "Kota Makassar"
2101 | },
2102 | {
2103 | "code": "7372",
2104 | "province_code": "73",
2105 | "name": "Kota Parepare"
2106 | },
2107 | {
2108 | "code": "7373",
2109 | "province_code": "73",
2110 | "name": "Kota Palopo"
2111 | },
2112 | {
2113 | "code": "7401",
2114 | "province_code": "74",
2115 | "name": "Kabupaten Kolaka"
2116 | },
2117 | {
2118 | "code": "7402",
2119 | "province_code": "74",
2120 | "name": "Kabupaten Konawe"
2121 | },
2122 | {
2123 | "code": "7403",
2124 | "province_code": "74",
2125 | "name": "Kabupaten Muna"
2126 | },
2127 | {
2128 | "code": "7404",
2129 | "province_code": "74",
2130 | "name": "Kabupaten Buton"
2131 | },
2132 | {
2133 | "code": "7405",
2134 | "province_code": "74",
2135 | "name": "Kabupaten Konawe Selatan"
2136 | },
2137 | {
2138 | "code": "7406",
2139 | "province_code": "74",
2140 | "name": "Kabupaten Bombana"
2141 | },
2142 | {
2143 | "code": "7407",
2144 | "province_code": "74",
2145 | "name": "Kabupaten Wakatobi"
2146 | },
2147 | {
2148 | "code": "7408",
2149 | "province_code": "74",
2150 | "name": "Kabupaten Kolaka Utara"
2151 | },
2152 | {
2153 | "code": "7409",
2154 | "province_code": "74",
2155 | "name": "Kabupaten Konawe Utara"
2156 | },
2157 | {
2158 | "code": "7410",
2159 | "province_code": "74",
2160 | "name": "Kabupaten Buton Utara"
2161 | },
2162 | {
2163 | "code": "7411",
2164 | "province_code": "74",
2165 | "name": "Kabupaten Kolaka Timur"
2166 | },
2167 | {
2168 | "code": "7412",
2169 | "province_code": "74",
2170 | "name": "Kabupaten Konawe Kepulauan"
2171 | },
2172 | {
2173 | "code": "7413",
2174 | "province_code": "74",
2175 | "name": "Kabupaten Muna Barat"
2176 | },
2177 | {
2178 | "code": "7414",
2179 | "province_code": "74",
2180 | "name": "Kabupaten Buton Tengah"
2181 | },
2182 | {
2183 | "code": "7415",
2184 | "province_code": "74",
2185 | "name": "Kabupaten Buton Selatan"
2186 | },
2187 | {
2188 | "code": "7471",
2189 | "province_code": "74",
2190 | "name": "Kota Kendari"
2191 | },
2192 | {
2193 | "code": "7472",
2194 | "province_code": "74",
2195 | "name": "Kota Bau Bau"
2196 | },
2197 | {
2198 | "code": "7501",
2199 | "province_code": "75",
2200 | "name": "Kabupaten Gorontalo"
2201 | },
2202 | {
2203 | "code": "7502",
2204 | "province_code": "75",
2205 | "name": "Kabupaten Boalemo"
2206 | },
2207 | {
2208 | "code": "7503",
2209 | "province_code": "75",
2210 | "name": "Kabupaten Bone Bolango"
2211 | },
2212 | {
2213 | "code": "7504",
2214 | "province_code": "75",
2215 | "name": "Kabupaten Pohuwato"
2216 | },
2217 | {
2218 | "code": "7505",
2219 | "province_code": "75",
2220 | "name": "Kabupaten Gorontalo Utara"
2221 | },
2222 | {
2223 | "code": "7571",
2224 | "province_code": "75",
2225 | "name": "Kota Gorontalo"
2226 | },
2227 | {
2228 | "code": "7601",
2229 | "province_code": "76",
2230 | "name": "Kabupaten Pasangkayu"
2231 | },
2232 | {
2233 | "code": "7602",
2234 | "province_code": "76",
2235 | "name": "Kabupaten Mamuju"
2236 | },
2237 | {
2238 | "code": "7603",
2239 | "province_code": "76",
2240 | "name": "Kabupaten Mamasa"
2241 | },
2242 | {
2243 | "code": "7604",
2244 | "province_code": "76",
2245 | "name": "Kabupaten Polewali Mandar"
2246 | },
2247 | {
2248 | "code": "7605",
2249 | "province_code": "76",
2250 | "name": "Kabupaten Majene"
2251 | },
2252 | {
2253 | "code": "7606",
2254 | "province_code": "76",
2255 | "name": "Kabupaten Mamuju Tengah"
2256 | },
2257 | {
2258 | "code": "8101",
2259 | "province_code": "81",
2260 | "name": "Kabupaten Maluku Tengah"
2261 | },
2262 | {
2263 | "code": "8102",
2264 | "province_code": "81",
2265 | "name": "Kabupaten Maluku Tenggara"
2266 | },
2267 | {
2268 | "code": "8103",
2269 | "province_code": "81",
2270 | "name": "Kabupaten Kepulauan Tanimbar"
2271 | },
2272 | {
2273 | "code": "8104",
2274 | "province_code": "81",
2275 | "name": "Kabupaten Buru"
2276 | },
2277 | {
2278 | "code": "8105",
2279 | "province_code": "81",
2280 | "name": "Kabupaten Seram Bagian Timur"
2281 | },
2282 | {
2283 | "code": "8106",
2284 | "province_code": "81",
2285 | "name": "Kabupaten Seram Bagian Barat"
2286 | },
2287 | {
2288 | "code": "8107",
2289 | "province_code": "81",
2290 | "name": "Kabupaten Kepulauan Aru"
2291 | },
2292 | {
2293 | "code": "8108",
2294 | "province_code": "81",
2295 | "name": "Kabupaten Maluku Barat Daya"
2296 | },
2297 | {
2298 | "code": "8109",
2299 | "province_code": "81",
2300 | "name": "Kabupaten Buru Selatan"
2301 | },
2302 | {
2303 | "code": "8171",
2304 | "province_code": "81",
2305 | "name": "Kota Ambon"
2306 | },
2307 | {
2308 | "code": "8172",
2309 | "province_code": "81",
2310 | "name": "Kota Tual"
2311 | },
2312 | {
2313 | "code": "8201",
2314 | "province_code": "82",
2315 | "name": "Kabupaten Halmahera Barat"
2316 | },
2317 | {
2318 | "code": "8202",
2319 | "province_code": "82",
2320 | "name": "Kabupaten Halmahera Tengah"
2321 | },
2322 | {
2323 | "code": "8203",
2324 | "province_code": "82",
2325 | "name": "Kabupaten Halmahera Utara"
2326 | },
2327 | {
2328 | "code": "8204",
2329 | "province_code": "82",
2330 | "name": "Kabupaten Halmahera Selatan"
2331 | },
2332 | {
2333 | "code": "8205",
2334 | "province_code": "82",
2335 | "name": "Kabupaten Kepulauan Sula"
2336 | },
2337 | {
2338 | "code": "8206",
2339 | "province_code": "82",
2340 | "name": "Kabupaten Halmahera Timur"
2341 | },
2342 | {
2343 | "code": "8207",
2344 | "province_code": "82",
2345 | "name": "Kabupaten Pulau Morotai"
2346 | },
2347 | {
2348 | "code": "8208",
2349 | "province_code": "82",
2350 | "name": "Kabupaten Pulau Taliabu"
2351 | },
2352 | {
2353 | "code": "8271",
2354 | "province_code": "82",
2355 | "name": "Kota Ternate"
2356 | },
2357 | {
2358 | "code": "8272",
2359 | "province_code": "82",
2360 | "name": "Kota Tidore Kepulauan"
2361 | },
2362 | {
2363 | "code": "9103",
2364 | "province_code": "91",
2365 | "name": "Kabupaten Jayapura"
2366 | },
2367 | {
2368 | "code": "9105",
2369 | "province_code": "91",
2370 | "name": "Kabupaten Kepulauan Yapen"
2371 | },
2372 | {
2373 | "code": "9106",
2374 | "province_code": "91",
2375 | "name": "Kabupaten Biak Numfor"
2376 | },
2377 | {
2378 | "code": "9110",
2379 | "province_code": "91",
2380 | "name": "Kabupaten Sarmi"
2381 | },
2382 | {
2383 | "code": "9111",
2384 | "province_code": "91",
2385 | "name": "Kabupaten Keerom"
2386 | },
2387 | {
2388 | "code": "9115",
2389 | "province_code": "91",
2390 | "name": "Kabupaten Waropen"
2391 | },
2392 | {
2393 | "code": "9119",
2394 | "province_code": "91",
2395 | "name": "Kabupaten Supiori"
2396 | },
2397 | {
2398 | "code": "9120",
2399 | "province_code": "91",
2400 | "name": "Kabupaten Mamberamo Raya"
2401 | },
2402 | {
2403 | "code": "9171",
2404 | "province_code": "91",
2405 | "name": "Kota Jayapura"
2406 | },
2407 | {
2408 | "code": "9202",
2409 | "province_code": "92",
2410 | "name": "Kabupaten Manokwari"
2411 | },
2412 | {
2413 | "code": "9203",
2414 | "province_code": "92",
2415 | "name": "Kabupaten Fak Fak"
2416 | },
2417 | {
2418 | "code": "9206",
2419 | "province_code": "92",
2420 | "name": "Kabupaten Teluk Bintuni"
2421 | },
2422 | {
2423 | "code": "9207",
2424 | "province_code": "92",
2425 | "name": "Kabupaten Teluk Wondama"
2426 | },
2427 | {
2428 | "code": "9208",
2429 | "province_code": "92",
2430 | "name": "Kabupaten Kaimana"
2431 | },
2432 | {
2433 | "code": "9211",
2434 | "province_code": "92",
2435 | "name": "Kabupaten Manokwari Selatan"
2436 | },
2437 | {
2438 | "code": "9212",
2439 | "province_code": "92",
2440 | "name": "Kabupaten Pegunungan Arfak"
2441 | },
2442 | {
2443 | "code": "9301",
2444 | "province_code": "93",
2445 | "name": "Kabupaten Merauke"
2446 | },
2447 | {
2448 | "code": "9302",
2449 | "province_code": "93",
2450 | "name": "Kabupaten Boven Digoel"
2451 | },
2452 | {
2453 | "code": "9303",
2454 | "province_code": "93",
2455 | "name": "Kabupaten Mappi"
2456 | },
2457 | {
2458 | "code": "9304",
2459 | "province_code": "93",
2460 | "name": "Kabupaten Asmat"
2461 | },
2462 | {
2463 | "code": "9401",
2464 | "province_code": "94",
2465 | "name": "Kabupaten Nabire"
2466 | },
2467 | {
2468 | "code": "9402",
2469 | "province_code": "94",
2470 | "name": "Kabupaten Puncak Jaya"
2471 | },
2472 | {
2473 | "code": "9403",
2474 | "province_code": "94",
2475 | "name": "Kabupaten Paniai"
2476 | },
2477 | {
2478 | "code": "9404",
2479 | "province_code": "94",
2480 | "name": "Kabupaten Mimika"
2481 | },
2482 | {
2483 | "code": "9405",
2484 | "province_code": "94",
2485 | "name": "Kabupaten Puncak"
2486 | },
2487 | {
2488 | "code": "9406",
2489 | "province_code": "94",
2490 | "name": "Kabupaten Dogiyai"
2491 | },
2492 | {
2493 | "code": "9407",
2494 | "province_code": "94",
2495 | "name": "Kabupaten Intan Jaya"
2496 | },
2497 | {
2498 | "code": "9408",
2499 | "province_code": "94",
2500 | "name": "Kabupaten Deiyai"
2501 | },
2502 | {
2503 | "code": "9501",
2504 | "province_code": "95",
2505 | "name": "Kabupaten Jayawijaya"
2506 | },
2507 | {
2508 | "code": "9502",
2509 | "province_code": "95",
2510 | "name": "Kab Pegunungan Bintang"
2511 | },
2512 | {
2513 | "code": "9503",
2514 | "province_code": "95",
2515 | "name": "Kabupaten Yahukimo"
2516 | },
2517 | {
2518 | "code": "9504",
2519 | "province_code": "95",
2520 | "name": "Kabupaten Tolikara"
2521 | },
2522 | {
2523 | "code": "9505",
2524 | "province_code": "95",
2525 | "name": "Kabupaten Mamberamo Tengah"
2526 | },
2527 | {
2528 | "code": "9506",
2529 | "province_code": "95",
2530 | "name": "Kabupaten Yalimo"
2531 | },
2532 | {
2533 | "code": "9507",
2534 | "province_code": "95",
2535 | "name": "Kabupaten Lanny Jaya"
2536 | },
2537 | {
2538 | "code": "9508",
2539 | "province_code": "95",
2540 | "name": "Kabupaten Nduga"
2541 | },
2542 | {
2543 | "code": "9601",
2544 | "province_code": "96",
2545 | "name": "Kabupaten Sorong"
2546 | },
2547 | {
2548 | "code": "9602",
2549 | "province_code": "96",
2550 | "name": "Kabupaten Sorong Selatan"
2551 | },
2552 | {
2553 | "code": "9603",
2554 | "province_code": "96",
2555 | "name": "Kabupaten Raja Ampat"
2556 | },
2557 | {
2558 | "code": "9604",
2559 | "province_code": "96",
2560 | "name": "Kabupaten Tambrauw"
2561 | },
2562 | {
2563 | "code": "9605",
2564 | "province_code": "96",
2565 | "name": "Kabupaten Maybrat"
2566 | },
2567 | {
2568 | "code": "9671",
2569 | "province_code": "96",
2570 | "name": "Kota Sorong"
2571 | }
2572 | ]
--------------------------------------------------------------------------------
/data/json/provinces.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "code": "11",
4 | "name": "Aceh"
5 | },
6 | {
7 | "code": "12",
8 | "name": "Sumatera Utara"
9 | },
10 | {
11 | "code": "13",
12 | "name": "Sumatera Barat"
13 | },
14 | {
15 | "code": "14",
16 | "name": "Riau"
17 | },
18 | {
19 | "code": "15",
20 | "name": "Jambi"
21 | },
22 | {
23 | "code": "16",
24 | "name": "Sumatera Selatan"
25 | },
26 | {
27 | "code": "17",
28 | "name": "Bengkulu"
29 | },
30 | {
31 | "code": "18",
32 | "name": "Lampung"
33 | },
34 | {
35 | "code": "19",
36 | "name": "Kepulauan Bangka Belitung"
37 | },
38 | {
39 | "code": "21",
40 | "name": "Kepulauan Riau"
41 | },
42 | {
43 | "code": "31",
44 | "name": "Daerah Khusus Ibukota Jakarta"
45 | },
46 | {
47 | "code": "32",
48 | "name": "Jawa Barat"
49 | },
50 | {
51 | "code": "33",
52 | "name": "Jawa Tengah"
53 | },
54 | {
55 | "code": "34",
56 | "name": "Daerah Istimewa Yogyakarta"
57 | },
58 | {
59 | "code": "35",
60 | "name": "Jawa Timur"
61 | },
62 | {
63 | "code": "36",
64 | "name": "Banten"
65 | },
66 | {
67 | "code": "51",
68 | "name": "Bali"
69 | },
70 | {
71 | "code": "52",
72 | "name": "Nusa Tenggara Barat"
73 | },
74 | {
75 | "code": "53",
76 | "name": "Nusa Tenggara Timur"
77 | },
78 | {
79 | "code": "61",
80 | "name": "Kalimantan Barat"
81 | },
82 | {
83 | "code": "62",
84 | "name": "Kalimantan Tengah"
85 | },
86 | {
87 | "code": "63",
88 | "name": "Kalimantan Selatan"
89 | },
90 | {
91 | "code": "64",
92 | "name": "Kalimantan Timur"
93 | },
94 | {
95 | "code": "65",
96 | "name": "Kalimantan Utara"
97 | },
98 | {
99 | "code": "71",
100 | "name": "Sulawesi Utara"
101 | },
102 | {
103 | "code": "72",
104 | "name": "Sulawesi Tengah"
105 | },
106 | {
107 | "code": "73",
108 | "name": "Sulawesi Selatan"
109 | },
110 | {
111 | "code": "74",
112 | "name": "Sulawesi Tenggara"
113 | },
114 | {
115 | "code": "75",
116 | "name": "Gorontalo"
117 | },
118 | {
119 | "code": "76",
120 | "name": "Sulawesi Barat"
121 | },
122 | {
123 | "code": "81",
124 | "name": "Maluku"
125 | },
126 | {
127 | "code": "82",
128 | "name": "Maluku Utara"
129 | },
130 | {
131 | "code": "91",
132 | "name": "Papua"
133 | },
134 | {
135 | "code": "92",
136 | "name": "Papua Barat"
137 | },
138 | {
139 | "code": "93",
140 | "name": "Papua Selatan"
141 | },
142 | {
143 | "code": "94",
144 | "name": "Papua Tengah"
145 | },
146 | {
147 | "code": "95",
148 | "name": "Papua Pegunungan"
149 | },
150 | {
151 | "code": "96",
152 | "name": "Papua Barat Daya"
153 | }
154 | ]
--------------------------------------------------------------------------------
/dist/cities.d.ts:
--------------------------------------------------------------------------------
1 | import { City } from '../types';
2 | export declare function getAllRegencies(): Promise;
3 | export declare function getCityByCode(code: number): Promise;
4 | export declare function getCityByName(name: string): Promise;
5 | export declare function getRegenciesOfProvinceCode(provinceCode: number): Promise;
6 | export declare function getRegenciesOfProvinceName(provinceName: string): Promise;
7 |
--------------------------------------------------------------------------------
/dist/cities.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4 | return new (P || (P = Promise))(function (resolve, reject) {
5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8 | step((generator = generator.apply(thisArg, _arguments || [])).next());
9 | });
10 | };
11 | var __generator = (this && this.__generator) || function (thisArg, body) {
12 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13 | return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14 | function verb(n) { return function (v) { return step([n, v]); }; }
15 | function step(op) {
16 | if (f) throw new TypeError("Generator is already executing.");
17 | while (g && (g = 0, op[0] && (_ = 0)), _) try {
18 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19 | if (y = 0, t) op = [op[0] & 2, t.value];
20 | switch (op[0]) {
21 | case 0: case 1: t = op; break;
22 | case 4: _.label++; return { value: op[1], done: false };
23 | case 5: _.label++; y = op[1]; op = [0]; continue;
24 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
25 | default:
26 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30 | if (t[2]) _.ops.pop();
31 | _.trys.pop(); continue;
32 | }
33 | op = body.call(thisArg, _);
34 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36 | }
37 | };
38 | var __importDefault = (this && this.__importDefault) || function (mod) {
39 | return (mod && mod.__esModule) ? mod : { "default": mod };
40 | };
41 | Object.defineProperty(exports, "__esModule", { value: true });
42 | exports.getAllRegencies = getAllRegencies;
43 | exports.getCityByCode = getCityByCode;
44 | exports.getCityByName = getCityByName;
45 | exports.getRegenciesOfProvinceCode = getRegenciesOfProvinceCode;
46 | exports.getRegenciesOfProvinceName = getRegenciesOfProvinceName;
47 | var cities_json_1 = __importDefault(require("../data/json/cities.json"));
48 | var provinces_json_1 = __importDefault(require("../data/json/provinces.json"));
49 | function getAllRegencies() {
50 | return __awaiter(this, void 0, void 0, function () {
51 | return __generator(this, function (_a) {
52 | return [2 /*return*/, cities_json_1.default.map(function (item) { return ({
53 | code: parseInt(item.code),
54 | province_code: parseInt(item.province_code),
55 | name: item.name
56 | }); })];
57 | });
58 | });
59 | }
60 | function getCityByCode(code) {
61 | return __awaiter(this, void 0, void 0, function () {
62 | var city;
63 | return __generator(this, function (_a) {
64 | city = cities_json_1.default.find(function (item) { return parseInt(item.code) === code; });
65 | if (!city) {
66 | throw new Error("City with code ".concat(code, " not found"));
67 | }
68 | return [2 /*return*/, {
69 | code: parseInt(city.code),
70 | province_code: parseInt(city.province_code),
71 | name: city.name
72 | }];
73 | });
74 | });
75 | }
76 | function getCityByName(name) {
77 | return __awaiter(this, void 0, void 0, function () {
78 | var city;
79 | return __generator(this, function (_a) {
80 | city = cities_json_1.default.find(function (item) { return item.name.toLowerCase().includes(name.toLowerCase()); });
81 | if (!city) {
82 | throw new Error("City with name ".concat(name, " not found"));
83 | }
84 | return [2 /*return*/, {
85 | code: parseInt(city.code),
86 | province_code: parseInt(city.province_code),
87 | name: city.name
88 | }];
89 | });
90 | });
91 | }
92 | function getRegenciesOfProvinceCode(provinceCode) {
93 | return __awaiter(this, void 0, void 0, function () {
94 | return __generator(this, function (_a) {
95 | return [2 /*return*/, cities_json_1.default.filter(function (item) { return parseInt(item.province_code) === provinceCode; }).map(function (item) { return ({
96 | code: parseInt(item.code),
97 | province_code: parseInt(item.province_code),
98 | name: item.name
99 | }); })];
100 | });
101 | });
102 | }
103 | function getRegenciesOfProvinceName(provinceName) {
104 | return __awaiter(this, void 0, void 0, function () {
105 | var province;
106 | return __generator(this, function (_a) {
107 | province = provinces_json_1.default.find(function (item) { return item.name.toLowerCase().includes(provinceName.toLowerCase()); });
108 | if (!province) {
109 | throw new Error("Province with name ".concat(provinceName, " not found"));
110 | }
111 | return [2 /*return*/, cities_json_1.default.filter(function (item) { return parseInt(item.province_code) === parseInt(province.code); }).map(function (item) { return ({
112 | code: parseInt(item.code),
113 | province_code: parseInt(item.province_code),
114 | name: item.name
115 | }); })];
116 | });
117 | });
118 | }
119 |
--------------------------------------------------------------------------------
/dist/districts.d.ts:
--------------------------------------------------------------------------------
1 | import { District } from '../types';
2 | export declare function getAllDistricts(): Promise;
3 | export declare function getDistrictByCode(code: number): Promise;
4 | export declare function getDistrictByName(name: string): Promise;
5 | export declare function getDistrictsOfCityCode(cityCode: number): Promise;
6 | export declare function getDistrictsOfCityName(cityName: string): Promise;
7 |
--------------------------------------------------------------------------------
/dist/districts.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4 | return new (P || (P = Promise))(function (resolve, reject) {
5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8 | step((generator = generator.apply(thisArg, _arguments || [])).next());
9 | });
10 | };
11 | var __generator = (this && this.__generator) || function (thisArg, body) {
12 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13 | return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14 | function verb(n) { return function (v) { return step([n, v]); }; }
15 | function step(op) {
16 | if (f) throw new TypeError("Generator is already executing.");
17 | while (g && (g = 0, op[0] && (_ = 0)), _) try {
18 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19 | if (y = 0, t) op = [op[0] & 2, t.value];
20 | switch (op[0]) {
21 | case 0: case 1: t = op; break;
22 | case 4: _.label++; return { value: op[1], done: false };
23 | case 5: _.label++; y = op[1]; op = [0]; continue;
24 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
25 | default:
26 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30 | if (t[2]) _.ops.pop();
31 | _.trys.pop(); continue;
32 | }
33 | op = body.call(thisArg, _);
34 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36 | }
37 | };
38 | var __importDefault = (this && this.__importDefault) || function (mod) {
39 | return (mod && mod.__esModule) ? mod : { "default": mod };
40 | };
41 | Object.defineProperty(exports, "__esModule", { value: true });
42 | exports.getAllDistricts = getAllDistricts;
43 | exports.getDistrictByCode = getDistrictByCode;
44 | exports.getDistrictByName = getDistrictByName;
45 | exports.getDistrictsOfCityCode = getDistrictsOfCityCode;
46 | exports.getDistrictsOfCityName = getDistrictsOfCityName;
47 | var districts_json_1 = __importDefault(require("../data/json/districts.json"));
48 | var cities_json_1 = __importDefault(require("../data/json/cities.json"));
49 | function getAllDistricts() {
50 | return __awaiter(this, void 0, void 0, function () {
51 | return __generator(this, function (_a) {
52 | return [2 /*return*/, districts_json_1.default.map(function (item) { return ({
53 | code: parseInt(item.code),
54 | city_code: parseInt(item.city_code),
55 | name: item.name
56 | }); })];
57 | });
58 | });
59 | }
60 | function getDistrictByCode(code) {
61 | return __awaiter(this, void 0, void 0, function () {
62 | var district;
63 | return __generator(this, function (_a) {
64 | district = districts_json_1.default.find(function (item) { return parseInt(item.code) === code; });
65 | if (!district) {
66 | throw new Error("District with code ".concat(code, " not found"));
67 | }
68 | return [2 /*return*/, {
69 | code: parseInt(district.code),
70 | city_code: parseInt(district.city_code),
71 | name: district.name
72 | }];
73 | });
74 | });
75 | }
76 | function getDistrictByName(name) {
77 | return __awaiter(this, void 0, void 0, function () {
78 | var district;
79 | return __generator(this, function (_a) {
80 | district = districts_json_1.default.find(function (item) { return item.name.toLowerCase().includes(name.toLowerCase()); });
81 | if (!district) {
82 | throw new Error("District with name ".concat(name, " not found"));
83 | }
84 | return [2 /*return*/, {
85 | code: parseInt(district.code),
86 | city_code: parseInt(district.city_code),
87 | name: district.name
88 | }];
89 | });
90 | });
91 | }
92 | function getDistrictsOfCityCode(cityCode) {
93 | return __awaiter(this, void 0, void 0, function () {
94 | return __generator(this, function (_a) {
95 | return [2 /*return*/, districts_json_1.default.filter(function (item) { return parseInt(item.city_code) === cityCode; }).map(function (item) { return ({
96 | code: parseInt(item.code),
97 | city_code: parseInt(item.city_code),
98 | name: item.name
99 | }); })];
100 | });
101 | });
102 | }
103 | function getDistrictsOfCityName(cityName) {
104 | return __awaiter(this, void 0, void 0, function () {
105 | var city;
106 | return __generator(this, function (_a) {
107 | city = cities_json_1.default.find(function (item) { return item.name.toLowerCase().includes(cityName.toLowerCase()); });
108 | if (!city) {
109 | throw new Error("City with name ".concat(cityName, " not found"));
110 | }
111 | return [2 /*return*/, districts_json_1.default.filter(function (item) { return parseInt(item.city_code) === parseInt(city.code); }).map(function (item) { return ({
112 | code: parseInt(item.code),
113 | city_code: parseInt(item.city_code),
114 | name: item.name
115 | }); })];
116 | });
117 | });
118 | }
119 |
--------------------------------------------------------------------------------
/dist/index.d.ts:
--------------------------------------------------------------------------------
1 | export { getAllProvinces, getProvinceByCode, getProvinceByName } from './provinces';
2 | export { getAllRegencies, getCityByCode, getCityByName, getRegenciesOfProvinceCode, getRegenciesOfProvinceName } from './cities';
3 | export { getAllDistricts, getDistrictByCode, getDistrictByName, getDistrictsOfCityCode, getDistrictsOfCityName } from './districts';
4 | export { getAllVillages, getVillageByCode, getVillageByName, getVillagesOfDistrictCode, getVillagesOfDistrictName } from './villages';
5 | export type { Province, City, District, Village } from '../types';
6 |
--------------------------------------------------------------------------------
/dist/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | exports.getVillagesOfDistrictName = exports.getVillagesOfDistrictCode = exports.getVillageByName = exports.getVillageByCode = exports.getAllVillages = exports.getDistrictsOfCityName = exports.getDistrictsOfCityCode = exports.getDistrictByName = exports.getDistrictByCode = exports.getAllDistricts = exports.getRegenciesOfProvinceName = exports.getRegenciesOfProvinceCode = exports.getCityByName = exports.getCityByCode = exports.getAllRegencies = exports.getProvinceByName = exports.getProvinceByCode = exports.getAllProvinces = void 0;
4 | var provinces_1 = require("./provinces");
5 | Object.defineProperty(exports, "getAllProvinces", { enumerable: true, get: function () { return provinces_1.getAllProvinces; } });
6 | Object.defineProperty(exports, "getProvinceByCode", { enumerable: true, get: function () { return provinces_1.getProvinceByCode; } });
7 | Object.defineProperty(exports, "getProvinceByName", { enumerable: true, get: function () { return provinces_1.getProvinceByName; } });
8 | var cities_1 = require("./cities");
9 | Object.defineProperty(exports, "getAllRegencies", { enumerable: true, get: function () { return cities_1.getAllRegencies; } });
10 | Object.defineProperty(exports, "getCityByCode", { enumerable: true, get: function () { return cities_1.getCityByCode; } });
11 | Object.defineProperty(exports, "getCityByName", { enumerable: true, get: function () { return cities_1.getCityByName; } });
12 | Object.defineProperty(exports, "getRegenciesOfProvinceCode", { enumerable: true, get: function () { return cities_1.getRegenciesOfProvinceCode; } });
13 | Object.defineProperty(exports, "getRegenciesOfProvinceName", { enumerable: true, get: function () { return cities_1.getRegenciesOfProvinceName; } });
14 | var districts_1 = require("./districts");
15 | Object.defineProperty(exports, "getAllDistricts", { enumerable: true, get: function () { return districts_1.getAllDistricts; } });
16 | Object.defineProperty(exports, "getDistrictByCode", { enumerable: true, get: function () { return districts_1.getDistrictByCode; } });
17 | Object.defineProperty(exports, "getDistrictByName", { enumerable: true, get: function () { return districts_1.getDistrictByName; } });
18 | Object.defineProperty(exports, "getDistrictsOfCityCode", { enumerable: true, get: function () { return districts_1.getDistrictsOfCityCode; } });
19 | Object.defineProperty(exports, "getDistrictsOfCityName", { enumerable: true, get: function () { return districts_1.getDistrictsOfCityName; } });
20 | var villages_1 = require("./villages");
21 | Object.defineProperty(exports, "getAllVillages", { enumerable: true, get: function () { return villages_1.getAllVillages; } });
22 | Object.defineProperty(exports, "getVillageByCode", { enumerable: true, get: function () { return villages_1.getVillageByCode; } });
23 | Object.defineProperty(exports, "getVillageByName", { enumerable: true, get: function () { return villages_1.getVillageByName; } });
24 | Object.defineProperty(exports, "getVillagesOfDistrictCode", { enumerable: true, get: function () { return villages_1.getVillagesOfDistrictCode; } });
25 | Object.defineProperty(exports, "getVillagesOfDistrictName", { enumerable: true, get: function () { return villages_1.getVillagesOfDistrictName; } });
26 |
--------------------------------------------------------------------------------
/dist/provinces.d.ts:
--------------------------------------------------------------------------------
1 | import { Province } from '../types';
2 | export declare function getAllProvinces(): Promise;
3 | export declare function getProvinceByCode(code: number): Promise;
4 | export declare function getProvinceByName(name: string): Promise;
5 |
--------------------------------------------------------------------------------
/dist/provinces.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4 | return new (P || (P = Promise))(function (resolve, reject) {
5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8 | step((generator = generator.apply(thisArg, _arguments || [])).next());
9 | });
10 | };
11 | var __generator = (this && this.__generator) || function (thisArg, body) {
12 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13 | return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14 | function verb(n) { return function (v) { return step([n, v]); }; }
15 | function step(op) {
16 | if (f) throw new TypeError("Generator is already executing.");
17 | while (g && (g = 0, op[0] && (_ = 0)), _) try {
18 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19 | if (y = 0, t) op = [op[0] & 2, t.value];
20 | switch (op[0]) {
21 | case 0: case 1: t = op; break;
22 | case 4: _.label++; return { value: op[1], done: false };
23 | case 5: _.label++; y = op[1]; op = [0]; continue;
24 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
25 | default:
26 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30 | if (t[2]) _.ops.pop();
31 | _.trys.pop(); continue;
32 | }
33 | op = body.call(thisArg, _);
34 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36 | }
37 | };
38 | var __importDefault = (this && this.__importDefault) || function (mod) {
39 | return (mod && mod.__esModule) ? mod : { "default": mod };
40 | };
41 | Object.defineProperty(exports, "__esModule", { value: true });
42 | exports.getAllProvinces = getAllProvinces;
43 | exports.getProvinceByCode = getProvinceByCode;
44 | exports.getProvinceByName = getProvinceByName;
45 | var provinces_json_1 = __importDefault(require("../data/json/provinces.json"));
46 | function getAllProvinces() {
47 | return __awaiter(this, void 0, void 0, function () {
48 | return __generator(this, function (_a) {
49 | return [2 /*return*/, provinces_json_1.default.map(function (item) { return ({
50 | code: parseInt(item.code),
51 | name: item.name
52 | }); })];
53 | });
54 | });
55 | }
56 | function getProvinceByCode(code) {
57 | return __awaiter(this, void 0, void 0, function () {
58 | var province;
59 | return __generator(this, function (_a) {
60 | province = provinces_json_1.default.find(function (item) { return parseInt(item.code) === code; });
61 | if (!province) {
62 | throw new Error("Province with code ".concat(code, " not found"));
63 | }
64 | return [2 /*return*/, {
65 | code: parseInt(province.code),
66 | name: province.name
67 | }];
68 | });
69 | });
70 | }
71 | function getProvinceByName(name) {
72 | return __awaiter(this, void 0, void 0, function () {
73 | var province;
74 | return __generator(this, function (_a) {
75 | province = provinces_json_1.default.find(function (item) { return item.name.toLowerCase().includes(name.toLowerCase()); });
76 | if (!province) {
77 | throw new Error("Province with name ".concat(name, " not found"));
78 | }
79 | return [2 /*return*/, {
80 | code: parseInt(province.code),
81 | name: province.name
82 | }];
83 | });
84 | });
85 | }
86 |
--------------------------------------------------------------------------------
/dist/villages.d.ts:
--------------------------------------------------------------------------------
1 | import { Village } from '../types';
2 | export declare function getAllVillages(): Promise;
3 | export declare function getVillageByCode(code: number): Promise;
4 | export declare function getVillageByName(name: string): Promise;
5 | export declare function getVillagesOfDistrictCode(districtCode: number): Promise;
6 | export declare function getVillagesOfDistrictName(districtName: string): Promise;
7 |
--------------------------------------------------------------------------------
/dist/villages.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4 | return new (P || (P = Promise))(function (resolve, reject) {
5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8 | step((generator = generator.apply(thisArg, _arguments || [])).next());
9 | });
10 | };
11 | var __generator = (this && this.__generator) || function (thisArg, body) {
12 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13 | return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14 | function verb(n) { return function (v) { return step([n, v]); }; }
15 | function step(op) {
16 | if (f) throw new TypeError("Generator is already executing.");
17 | while (g && (g = 0, op[0] && (_ = 0)), _) try {
18 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19 | if (y = 0, t) op = [op[0] & 2, t.value];
20 | switch (op[0]) {
21 | case 0: case 1: t = op; break;
22 | case 4: _.label++; return { value: op[1], done: false };
23 | case 5: _.label++; y = op[1]; op = [0]; continue;
24 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
25 | default:
26 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30 | if (t[2]) _.ops.pop();
31 | _.trys.pop(); continue;
32 | }
33 | op = body.call(thisArg, _);
34 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36 | }
37 | };
38 | var __importDefault = (this && this.__importDefault) || function (mod) {
39 | return (mod && mod.__esModule) ? mod : { "default": mod };
40 | };
41 | Object.defineProperty(exports, "__esModule", { value: true });
42 | exports.getAllVillages = getAllVillages;
43 | exports.getVillageByCode = getVillageByCode;
44 | exports.getVillageByName = getVillageByName;
45 | exports.getVillagesOfDistrictCode = getVillagesOfDistrictCode;
46 | exports.getVillagesOfDistrictName = getVillagesOfDistrictName;
47 | var villages_json_1 = __importDefault(require("../data/json/villages.json"));
48 | var districts_json_1 = __importDefault(require("../data/json/districts.json"));
49 | var villages = villages_json_1.default;
50 | var districts = districts_json_1.default;
51 | function getAllVillages() {
52 | return __awaiter(this, void 0, void 0, function () {
53 | return __generator(this, function (_a) {
54 | return [2 /*return*/, villages.map(function (item) { return ({
55 | code: parseInt(item.code),
56 | district_code: parseInt(item.district_code),
57 | name: item.name,
58 | postal_code: parseInt(item.postal_code)
59 | }); })];
60 | });
61 | });
62 | }
63 | function getVillageByCode(code) {
64 | return __awaiter(this, void 0, void 0, function () {
65 | var village;
66 | return __generator(this, function (_a) {
67 | village = villages.find(function (item) { return parseInt(item.code) === code; });
68 | if (!village) {
69 | throw new Error("Village with code ".concat(code, " not found"));
70 | }
71 | return [2 /*return*/, {
72 | code: parseInt(village.code),
73 | district_code: parseInt(village.district_code),
74 | name: village.name,
75 | postal_code: parseInt(village.postal_code)
76 | }];
77 | });
78 | });
79 | }
80 | function getVillageByName(name) {
81 | return __awaiter(this, void 0, void 0, function () {
82 | var village;
83 | return __generator(this, function (_a) {
84 | village = villages.find(function (item) { return item.name.toLowerCase().includes(name.toLowerCase()); });
85 | if (!village) {
86 | throw new Error("Village with name ".concat(name, " not found"));
87 | }
88 | return [2 /*return*/, {
89 | code: parseInt(village.code),
90 | district_code: parseInt(village.district_code),
91 | name: village.name,
92 | postal_code: parseInt(village.postal_code)
93 | }];
94 | });
95 | });
96 | }
97 | function getVillagesOfDistrictCode(districtCode) {
98 | return __awaiter(this, void 0, void 0, function () {
99 | return __generator(this, function (_a) {
100 | return [2 /*return*/, villages.filter(function (item) { return parseInt(item.district_code) === districtCode; }).map(function (item) { return ({
101 | code: parseInt(item.code),
102 | district_code: parseInt(item.district_code),
103 | name: item.name,
104 | postal_code: parseInt(item.postal_code)
105 | }); })];
106 | });
107 | });
108 | }
109 | function getVillagesOfDistrictName(districtName) {
110 | return __awaiter(this, void 0, void 0, function () {
111 | var district;
112 | return __generator(this, function (_a) {
113 | district = districts.find(function (item) { return item.name.toLowerCase().includes(districtName.toLowerCase()); });
114 | if (!district) {
115 | throw new Error("District with name ".concat(districtName, " not found"));
116 | }
117 | return [2 /*return*/, villages.filter(function (item) { return parseInt(item.district_code) === parseInt(district.code); }).map(function (item) { return ({
118 | code: parseInt(item.code),
119 | district_code: parseInt(item.district_code),
120 | name: item.name,
121 | postal_code: parseInt(item.postal_code)
122 | }); })];
123 | });
124 | });
125 | }
126 |
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "indonesia-nodejs",
3 | "version": "1.1.0",
4 | "lockfileVersion": 3,
5 | "requires": true,
6 | "packages": {
7 | "": {
8 | "name": "indonesia-nodejs",
9 | "version": "1.1.0",
10 | "license": "MIT",
11 | "devDependencies": {
12 | "csvtojson": "^2.0.10",
13 | "ts-node": "^10.0.0",
14 | "typescript": "^5.0.0"
15 | }
16 | },
17 | "node_modules/@cspotcode/source-map-support": {
18 | "version": "0.8.1",
19 | "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
20 | "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
21 | "dev": true,
22 | "dependencies": {
23 | "@jridgewell/trace-mapping": "0.3.9"
24 | },
25 | "engines": {
26 | "node": ">=12"
27 | }
28 | },
29 | "node_modules/@jridgewell/resolve-uri": {
30 | "version": "3.1.2",
31 | "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
32 | "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
33 | "dev": true,
34 | "engines": {
35 | "node": ">=6.0.0"
36 | }
37 | },
38 | "node_modules/@jridgewell/sourcemap-codec": {
39 | "version": "1.5.0",
40 | "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
41 | "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==",
42 | "dev": true
43 | },
44 | "node_modules/@jridgewell/trace-mapping": {
45 | "version": "0.3.9",
46 | "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
47 | "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
48 | "dev": true,
49 | "dependencies": {
50 | "@jridgewell/resolve-uri": "^3.0.3",
51 | "@jridgewell/sourcemap-codec": "^1.4.10"
52 | }
53 | },
54 | "node_modules/@tsconfig/node10": {
55 | "version": "1.0.11",
56 | "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz",
57 | "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==",
58 | "dev": true
59 | },
60 | "node_modules/@tsconfig/node12": {
61 | "version": "1.0.11",
62 | "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
63 | "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
64 | "dev": true
65 | },
66 | "node_modules/@tsconfig/node14": {
67 | "version": "1.0.3",
68 | "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
69 | "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
70 | "dev": true
71 | },
72 | "node_modules/@tsconfig/node16": {
73 | "version": "1.0.4",
74 | "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
75 | "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
76 | "dev": true
77 | },
78 | "node_modules/@types/node": {
79 | "version": "24.0.3",
80 | "resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.3.tgz",
81 | "integrity": "sha512-R4I/kzCYAdRLzfiCabn9hxWfbuHS573x+r0dJMkkzThEa7pbrcDWK+9zu3e7aBOouf+rQAciqPFMnxwr0aWgKg==",
82 | "dev": true,
83 | "peer": true,
84 | "dependencies": {
85 | "undici-types": "~7.8.0"
86 | }
87 | },
88 | "node_modules/acorn": {
89 | "version": "8.15.0",
90 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
91 | "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
92 | "dev": true,
93 | "bin": {
94 | "acorn": "bin/acorn"
95 | },
96 | "engines": {
97 | "node": ">=0.4.0"
98 | }
99 | },
100 | "node_modules/acorn-walk": {
101 | "version": "8.3.4",
102 | "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",
103 | "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",
104 | "dev": true,
105 | "dependencies": {
106 | "acorn": "^8.11.0"
107 | },
108 | "engines": {
109 | "node": ">=0.4.0"
110 | }
111 | },
112 | "node_modules/arg": {
113 | "version": "4.1.3",
114 | "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
115 | "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
116 | "dev": true
117 | },
118 | "node_modules/bluebird": {
119 | "version": "3.7.2",
120 | "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
121 | "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==",
122 | "dev": true
123 | },
124 | "node_modules/create-require": {
125 | "version": "1.1.1",
126 | "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
127 | "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
128 | "dev": true
129 | },
130 | "node_modules/csvtojson": {
131 | "version": "2.0.10",
132 | "resolved": "https://registry.npmjs.org/csvtojson/-/csvtojson-2.0.10.tgz",
133 | "integrity": "sha512-lUWFxGKyhraKCW8Qghz6Z0f2l/PqB1W3AO0HKJzGIQ5JRSlR651ekJDiGJbBT4sRNNv5ddnSGVEnsxP9XRCVpQ==",
134 | "dev": true,
135 | "dependencies": {
136 | "bluebird": "^3.5.1",
137 | "lodash": "^4.17.3",
138 | "strip-bom": "^2.0.0"
139 | },
140 | "bin": {
141 | "csvtojson": "bin/csvtojson"
142 | },
143 | "engines": {
144 | "node": ">=4.0.0"
145 | }
146 | },
147 | "node_modules/diff": {
148 | "version": "4.0.2",
149 | "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
150 | "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
151 | "dev": true,
152 | "engines": {
153 | "node": ">=0.3.1"
154 | }
155 | },
156 | "node_modules/is-utf8": {
157 | "version": "0.2.1",
158 | "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
159 | "integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==",
160 | "dev": true
161 | },
162 | "node_modules/lodash": {
163 | "version": "4.17.21",
164 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
165 | "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
166 | "dev": true
167 | },
168 | "node_modules/make-error": {
169 | "version": "1.3.6",
170 | "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
171 | "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
172 | "dev": true
173 | },
174 | "node_modules/strip-bom": {
175 | "version": "2.0.0",
176 | "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
177 | "integrity": "sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==",
178 | "dev": true,
179 | "dependencies": {
180 | "is-utf8": "^0.2.0"
181 | },
182 | "engines": {
183 | "node": ">=0.10.0"
184 | }
185 | },
186 | "node_modules/ts-node": {
187 | "version": "10.9.2",
188 | "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
189 | "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
190 | "dev": true,
191 | "dependencies": {
192 | "@cspotcode/source-map-support": "^0.8.0",
193 | "@tsconfig/node10": "^1.0.7",
194 | "@tsconfig/node12": "^1.0.7",
195 | "@tsconfig/node14": "^1.0.0",
196 | "@tsconfig/node16": "^1.0.2",
197 | "acorn": "^8.4.1",
198 | "acorn-walk": "^8.1.1",
199 | "arg": "^4.1.0",
200 | "create-require": "^1.1.0",
201 | "diff": "^4.0.1",
202 | "make-error": "^1.1.1",
203 | "v8-compile-cache-lib": "^3.0.1",
204 | "yn": "3.1.1"
205 | },
206 | "bin": {
207 | "ts-node": "dist/bin.js",
208 | "ts-node-cwd": "dist/bin-cwd.js",
209 | "ts-node-esm": "dist/bin-esm.js",
210 | "ts-node-script": "dist/bin-script.js",
211 | "ts-node-transpile-only": "dist/bin-transpile.js",
212 | "ts-script": "dist/bin-script-deprecated.js"
213 | },
214 | "peerDependencies": {
215 | "@swc/core": ">=1.2.50",
216 | "@swc/wasm": ">=1.2.50",
217 | "@types/node": "*",
218 | "typescript": ">=2.7"
219 | },
220 | "peerDependenciesMeta": {
221 | "@swc/core": {
222 | "optional": true
223 | },
224 | "@swc/wasm": {
225 | "optional": true
226 | }
227 | }
228 | },
229 | "node_modules/typescript": {
230 | "version": "5.8.3",
231 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
232 | "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
233 | "dev": true,
234 | "bin": {
235 | "tsc": "bin/tsc",
236 | "tsserver": "bin/tsserver"
237 | },
238 | "engines": {
239 | "node": ">=14.17"
240 | }
241 | },
242 | "node_modules/undici-types": {
243 | "version": "7.8.0",
244 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
245 | "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
246 | "dev": true,
247 | "peer": true
248 | },
249 | "node_modules/v8-compile-cache-lib": {
250 | "version": "3.0.1",
251 | "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
252 | "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
253 | "dev": true
254 | },
255 | "node_modules/yn": {
256 | "version": "3.1.1",
257 | "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
258 | "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
259 | "dev": true,
260 | "engines": {
261 | "node": ">=6"
262 | }
263 | }
264 | }
265 | }
266 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "indonesia-nodejs",
3 | "version": "1.1.0",
4 | "description": "Data Wilayah Indonesia terbaru berdasarkan Kepmendagri tahun 2025 - Provinsi, Kabupaten, Kecamatan, Desa",
5 | "main": "dist/index.js",
6 | "types": "types/index.d.ts",
7 | "files": [
8 | "dist",
9 | "data/json",
10 | "types"
11 | ],
12 | "scripts": {
13 | "build": "tsc",
14 | "convert": "ts-node scripts/csv-to-json.ts"
15 | },
16 | "keywords": [
17 | "indonesia",
18 | "data",
19 | "wilayah",
20 | "provinsi",
21 | "kabupaten",
22 | "kecamatan",
23 | "desa"
24 | ],
25 | "author": "M. Hamdani Ilham Latjoro",
26 | "license": "MIT",
27 | "repository": {
28 | "type": "git",
29 | "url": "https://github.com/dhank77/indonesia-nodejs"
30 | },
31 | "devDependencies": {
32 | "csvtojson": "^2.0.10",
33 | "ts-node": "^10.0.0",
34 | "typescript": "^5.0.0"
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/scripts/csv-to-json.ts:
--------------------------------------------------------------------------------
1 | import csv from 'csvtojson';
2 | import * as fs from 'fs';
3 | import * as path from 'path';
4 |
5 | const files = [
6 | { csvFile: 'data/csv/provinces.csv', jsonFile: 'data/json/provinces.json' },
7 | { csvFile: 'data/csv/cities.csv', jsonFile: 'data/json/cities.json' },
8 | { csvFile: 'data/csv/districts.csv', jsonFile: 'data/json/districts.json' },
9 | { csvFile: 'data/csv/villages.csv', jsonFile: 'data/json/villages.json' },
10 | ];
11 |
12 | async function convertCSVtoJSON() {
13 | for (const file of files) {
14 | let jsonArray;
15 |
16 | if (file.csvFile.includes('provinces')) {
17 | jsonArray = await csv({
18 | noheader: true,
19 | headers: ['code', 'name']
20 | }).fromFile(path.resolve(file.csvFile));
21 | } else if (file.csvFile.includes('cities')) {
22 | jsonArray = await csv({
23 | noheader: true,
24 | headers: ['code', 'province_code', 'name']
25 | }).fromFile(path.resolve(file.csvFile));
26 | } else if (file.csvFile.includes('districts')) {
27 | jsonArray = await csv({
28 | noheader: true,
29 | headers: ['code', 'city_code', 'name']
30 | }).fromFile(path.resolve(file.csvFile));
31 | } else if (file.csvFile.includes('villages')) {
32 | jsonArray = await csv({
33 | noheader: true,
34 | headers: ['code', 'district_code', 'name', 'postal_code']
35 | }).fromFile(path.resolve(file.csvFile));
36 | }
37 |
38 | fs.writeFileSync(path.resolve(file.jsonFile), JSON.stringify(jsonArray, null, 2));
39 | console.log(`Converted: ${file.csvFile} -> ${file.jsonFile}`);
40 | }
41 | console.log('All files converted successfully!');
42 | }
43 |
44 | convertCSVtoJSON();
--------------------------------------------------------------------------------
/src/cities.ts:
--------------------------------------------------------------------------------
1 | import cities from '../data/json/cities.json';
2 | import provinces from '../data/json/provinces.json';
3 | import { City } from '../types';
4 |
5 | export async function getAllRegencies(): Promise {
6 | return cities.map((item: any) => ({
7 | code: parseInt(item.code),
8 | province_code: parseInt(item.province_code),
9 | name: item.name
10 | }));
11 | }
12 |
13 | export async function getCityByCode(code: number): Promise {
14 | const city = cities.find((item: any) => parseInt(item.code) === code);
15 | if (!city) {
16 | throw new Error(`City with code ${code} not found`);
17 | }
18 | return {
19 | code: parseInt(city.code),
20 | province_code: parseInt(city.province_code),
21 | name: city.name
22 | };
23 | }
24 |
25 | export async function getCityByName(name: string): Promise {
26 | const city = cities.find((item: any) => item.name.toLowerCase().includes(name.toLowerCase()));
27 | if (!city) {
28 | throw new Error(`City with name ${name} not found`);
29 | }
30 | return {
31 | code: parseInt(city.code),
32 | province_code: parseInt(city.province_code),
33 | name: city.name
34 | };
35 | }
36 |
37 | export async function getRegenciesOfProvinceCode(provinceCode: number): Promise {
38 | return cities.filter((item: any) => parseInt(item.province_code) === provinceCode).map((item: any) => ({
39 | code: parseInt(item.code),
40 | province_code: parseInt(item.province_code),
41 | name: item.name
42 | }));
43 | }
44 |
45 | export async function getRegenciesOfProvinceName(provinceName: string): Promise {
46 | const province = provinces.find((item: any) => item.name.toLowerCase().includes(provinceName.toLowerCase()));
47 | if (!province) {
48 | throw new Error(`Province with name ${provinceName} not found`);
49 | }
50 | return cities.filter((item: any) => parseInt(item.province_code) === parseInt((province as any).code)).map((item: any) => ({
51 | code: parseInt(item.code),
52 | province_code: parseInt(item.province_code),
53 | name: item.name
54 | }));
55 | }
--------------------------------------------------------------------------------
/src/districts.ts:
--------------------------------------------------------------------------------
1 | import districts from '../data/json/districts.json';
2 | import cities from '../data/json/cities.json';
3 | import { District } from '../types';
4 |
5 | export async function getAllDistricts(): Promise {
6 | return districts.map((item: any) => ({
7 | code: parseInt(item.code),
8 | city_code: parseInt(item.city_code),
9 | name: item.name
10 | }));
11 | }
12 |
13 | export async function getDistrictByCode(code: number): Promise {
14 | const district = districts.find((item: any) => parseInt(item.code) === code);
15 | if (!district) {
16 | throw new Error(`District with code ${code} not found`);
17 | }
18 | return {
19 | code: parseInt(district.code),
20 | city_code: parseInt(district.city_code),
21 | name: district.name
22 | };
23 | }
24 |
25 | export async function getDistrictByName(name: string): Promise {
26 | const district = districts.find((item: any) => item.name.toLowerCase().includes(name.toLowerCase()));
27 | if (!district) {
28 | throw new Error(`District with name ${name} not found`);
29 | }
30 | return {
31 | code: parseInt(district.code),
32 | city_code: parseInt(district.city_code),
33 | name: district.name
34 | };
35 | }
36 |
37 | export async function getDistrictsOfCityCode(cityCode: number): Promise {
38 | return districts.filter((item: any) => parseInt(item.city_code) === cityCode).map((item: any) => ({
39 | code: parseInt(item.code),
40 | city_code: parseInt(item.city_code),
41 | name: item.name
42 | }));
43 | }
44 |
45 | export async function getDistrictsOfCityName(cityName: string): Promise {
46 | const city = cities.find((item: any) => item.name.toLowerCase().includes(cityName.toLowerCase()));
47 | if (!city) {
48 | throw new Error(`City with name ${cityName} not found`);
49 | }
50 | return districts.filter((item: any) => parseInt(item.city_code) === parseInt((city as any).code)).map((item: any) => ({
51 | code: parseInt(item.code),
52 | city_code: parseInt(item.city_code),
53 | name: item.name
54 | }));
55 | }
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | export {
2 | getAllProvinces,
3 | getProvinceByCode,
4 | getProvinceByName
5 | } from './provinces';
6 |
7 | export {
8 | getAllRegencies,
9 | getCityByCode,
10 | getCityByName,
11 | getRegenciesOfProvinceCode,
12 | getRegenciesOfProvinceName
13 | } from './cities';
14 |
15 | export {
16 | getAllDistricts,
17 | getDistrictByCode,
18 | getDistrictByName,
19 | getDistrictsOfCityCode,
20 | getDistrictsOfCityName
21 | } from './districts';
22 |
23 | export {
24 | getAllVillages,
25 | getVillageByCode,
26 | getVillageByName,
27 | getVillagesOfDistrictCode,
28 | getVillagesOfDistrictName
29 | } from './villages';
30 |
31 | export type { Province, City, District, Village } from '../types';
--------------------------------------------------------------------------------
/src/provinces.ts:
--------------------------------------------------------------------------------
1 | import provinces from '../data/json/provinces.json';
2 | import { Province } from '../types';
3 |
4 | export async function getAllProvinces(): Promise {
5 | return provinces.map((item: any) => ({
6 | code: parseInt(item.code),
7 | name: item.name
8 | }));
9 | }
10 |
11 | export async function getProvinceByCode(code: number): Promise {
12 | const province = provinces.find((item: any) => parseInt(item.code) === code);
13 | if (!province) {
14 | throw new Error(`Province with code ${code} not found`);
15 | }
16 | return {
17 | code: parseInt(province.code),
18 | name: province.name
19 | };
20 | }
21 |
22 | export async function getProvinceByName(name: string): Promise {
23 | const province = provinces.find((item: any) => item.name.toLowerCase().includes(name.toLowerCase()));
24 | if (!province) {
25 | throw new Error(`Province with name ${name} not found`);
26 | }
27 | return {
28 | code: parseInt(province.code),
29 | name: province.name
30 | };
31 | }
--------------------------------------------------------------------------------
/src/villages.ts:
--------------------------------------------------------------------------------
1 | import villagesData from '../data/json/villages.json';
2 | import districtsData from '../data/json/districts.json';
3 | import { Village } from '../types';
4 |
5 | const villages = villagesData as any[];
6 | const districts = districtsData as any[];
7 |
8 | export async function getAllVillages(): Promise {
9 | return villages.map((item: any) => ({
10 | code: parseInt(item.code),
11 | district_code: parseInt(item.district_code),
12 | name: item.name,
13 | postal_code: parseInt(item.postal_code)
14 | }));
15 | }
16 |
17 | export async function getVillageByCode(code: number): Promise {
18 | const village = villages.find((item: any) => parseInt(item.code) === code);
19 | if (!village) {
20 | throw new Error(`Village with code ${code} not found`);
21 | }
22 | return {
23 | code: parseInt(village.code),
24 | district_code: parseInt(village.district_code),
25 | name: village.name,
26 | postal_code: parseInt(village.postal_code)
27 | };
28 | }
29 |
30 | export async function getVillageByName(name: string): Promise {
31 | const village = villages.find((item: any) => item.name.toLowerCase().includes(name.toLowerCase()));
32 | if (!village) {
33 | throw new Error(`Village with name ${name} not found`);
34 | }
35 | return {
36 | code: parseInt(village.code),
37 | district_code: parseInt(village.district_code),
38 | name: village.name,
39 | postal_code: parseInt(village.postal_code)
40 | };
41 | }
42 |
43 | export async function getVillagesOfDistrictCode(districtCode: number): Promise {
44 | return villages.filter((item: any) => parseInt(item.district_code) === districtCode).map((item: any) => ({
45 | code: parseInt(item.code),
46 | district_code: parseInt(item.district_code),
47 | name: item.name,
48 | postal_code: parseInt(item.postal_code)
49 | }));
50 | }
51 |
52 | export async function getVillagesOfDistrictName(districtName: string): Promise {
53 | const district = districts.find((item: any) => item.name.toLowerCase().includes(districtName.toLowerCase()));
54 | if (!district) {
55 | throw new Error(`District with name ${districtName} not found`);
56 | }
57 | return villages.filter((item: any) => parseInt(item.district_code) === parseInt((district as any).code)).map((item: any) => ({
58 | code: parseInt(item.code),
59 | district_code: parseInt(item.district_code),
60 | name: item.name,
61 | postal_code: parseInt(item.postal_code)
62 | }));
63 | }
--------------------------------------------------------------------------------
/test-project/index.js:
--------------------------------------------------------------------------------
1 | const {
2 | // Province functions
3 | getAllProvinces,
4 | getProvinceByCode,
5 | getProvinceByName,
6 |
7 | // City/Regency functions
8 | getAllRegencies,
9 | getCityByCode,
10 | getCityByName,
11 | getRegenciesOfProvinceCode,
12 | getRegenciesOfProvinceName,
13 |
14 | // District functions
15 | getAllDistricts,
16 | getDistrictByCode,
17 | getDistrictByName,
18 | getDistrictsOfCityCode,
19 | getDistrictsOfCityName,
20 |
21 | // Village functions
22 | getAllVillages,
23 | getVillageByCode,
24 | getVillageByName,
25 | getVillagesOfDistrictCode,
26 | getVillagesOfDistrictName
27 | } = require('../dist/index.js');
28 |
29 | // ===== TEST CONFIGURATION =====
30 | const TEST_CONFIG = {
31 | SAMPLE_PROVINCE_CODE: 11,
32 | SAMPLE_CITY_CODE: 1101,
33 | SAMPLE_DISTRICT_CODE: 110101,
34 | SAMPLE_VILLAGE_CODE: 1101012001,
35 | SAMPLE_PROVINCE_NAME: 'Jakarta',
36 | SAMPLE_CITY_NAME: 'Jakarta Pusat',
37 | SAMPLE_DISTRICT_NAME: 'Bakongan',
38 | SAMPLE_VILLAGE_NAME: 'Keude Bakongan'
39 | };
40 |
41 | // ===== LOGGING UTILITIES =====
42 | const LogLevel = {
43 | INFO: 0,
44 | SUCCESS: 1,
45 | WARNING: 2,
46 | ERROR: 3
47 | };
48 |
49 | function log(level, message) {
50 | const prefixes = ['ℹ️', '✅', '⚠️', '❌'];
51 | const colors = ['\x1b[36m', '\x1b[32m', '\x1b[33m', '\x1b[31m'];
52 | const reset = '\x1b[0m';
53 | console.log(`${colors[level]}${prefixes[level]} ${message}${reset}`);
54 | }
55 |
56 | // ===== VALIDATION UTILITIES =====
57 | function validateProvince(province) {
58 | return province &&
59 | typeof province.code === 'number' &&
60 | typeof province.name === 'string';
61 | }
62 |
63 | function validateCity(city) {
64 | return city &&
65 | typeof city.code === 'number' &&
66 | typeof city.province_code === 'number' &&
67 | typeof city.name === 'string';
68 | }
69 |
70 | function validateDistrict(district) {
71 | return district &&
72 | typeof district.code === 'number' &&
73 | typeof district.city_code === 'number' &&
74 | typeof district.name === 'string';
75 | }
76 |
77 | function validateVillage(village) {
78 | return village &&
79 | typeof village.code === 'number' &&
80 | typeof village.district_code === 'number' &&
81 | typeof village.name === 'string';
82 | }
83 |
84 | // ===== TEST STATISTICS =====
85 | const testStats = {
86 | passed: 0,
87 | failed: 0,
88 | skipped: 0,
89 | totalTime: 0
90 | };
91 |
92 | // ===== MODULE EXPORT TESTS =====
93 | function testModuleExports() {
94 | log(LogLevel.INFO, 'TESTING MODULE EXPORTS');
95 | console.log('━'.repeat(50));
96 |
97 | const expectedExports = [
98 | 'getAllProvinces', 'getProvinceByCode', 'getProvinceByName',
99 | 'getAllRegencies', 'getCityByCode', 'getCityByName', 'getRegenciesOfProvinceCode', 'getRegenciesOfProvinceName',
100 | 'getAllDistricts', 'getDistrictByCode', 'getDistrictByName', 'getDistrictsOfCityCode', 'getDistrictsOfCityName',
101 | 'getAllVillages', 'getVillageByCode', 'getVillageByName', 'getVillagesOfDistrictCode', 'getVillagesOfDistrictName'
102 | ];
103 |
104 | const moduleExports = require('../dist/index.js');
105 |
106 | expectedExports.forEach(exportName => {
107 | if (typeof moduleExports[exportName] === 'function') {
108 | log(LogLevel.SUCCESS, `Export '${exportName}' is available and is a function`);
109 | testStats.passed++;
110 | } else {
111 | log(LogLevel.ERROR, `Export '${exportName}' is missing or not a function`);
112 | testStats.failed++;
113 | }
114 | });
115 |
116 | console.log('');
117 | }
118 |
119 | // ===== INDIVIDUAL TEST FUNCTIONS =====
120 | async function testFunction(testName, testFn, validator) {
121 | try {
122 | const startTime = Date.now();
123 | const result = await testFn();
124 | const endTime = Date.now();
125 |
126 | if (validator && !validator(result)) {
127 | log(LogLevel.WARNING, `${testName} - Data validation failed`);
128 | testStats.skipped++;
129 | return null;
130 | }
131 |
132 | log(LogLevel.SUCCESS, `${testName} (${endTime - startTime}ms)`);
133 | testStats.passed++;
134 | return result;
135 | } catch (error) {
136 | log(LogLevel.ERROR, `${testName} - ${error.message}`);
137 | testStats.failed++;
138 | return null;
139 | }
140 | }
141 |
142 | // ===== MAIN TEST SUITE =====
143 | async function runTests() {
144 | const overallStartTime = Date.now();
145 |
146 | console.log('\n🚀 ===== TESTING COMPILED INDEX.JS MODULE =====\n');
147 |
148 | // Memory monitoring
149 | const memBefore = process.memoryUsage();
150 |
151 | try {
152 | // Test module exports first
153 | testModuleExports();
154 |
155 | // ===== PROVINCE TESTS =====
156 | log(LogLevel.INFO, 'TESTING PROVINCE FUNCTIONS');
157 | console.log('━'.repeat(50));
158 |
159 | const provinces = await testFunction(
160 | 'getAllProvinces() from compiled module',
161 | () => getAllProvinces(),
162 | (result) => Array.isArray(result) && result.length > 0 && validateProvince(result[0])
163 | );
164 |
165 | if (provinces && provinces.length > 0) {
166 | console.log(` 📊 Total provinces: ${provinces.length}`);
167 | console.log(` 🏛️ First province: ${provinces[0].name} (${provinces[0].code})`);
168 |
169 | await testFunction(
170 | `getProvinceByCode(${TEST_CONFIG.SAMPLE_PROVINCE_CODE}) from compiled module`,
171 | () => getProvinceByCode(TEST_CONFIG.SAMPLE_PROVINCE_CODE),
172 | validateProvince
173 | );
174 |
175 | await testFunction(
176 | `getProvinceByName('${TEST_CONFIG.SAMPLE_PROVINCE_NAME}') from compiled module`,
177 | () => getProvinceByName(TEST_CONFIG.SAMPLE_PROVINCE_NAME),
178 | validateProvince
179 | );
180 | }
181 |
182 | console.log('');
183 |
184 | // ===== CITY/REGENCY TESTS =====
185 | log(LogLevel.INFO, 'TESTING CITY/REGENCY FUNCTIONS');
186 | console.log('━'.repeat(50));
187 |
188 | const regencies = await testFunction(
189 | 'getAllRegencies() from compiled module',
190 | () => getAllRegencies(),
191 | (result) => Array.isArray(result) && result.length > 0 && validateCity(result[0])
192 | );
193 |
194 | if (regencies && regencies.length > 0) {
195 | console.log(` 📊 Total regencies: ${regencies.length}`);
196 | console.log(` 🏙️ First regency: ${regencies[0].name} (${regencies[0].code})`);
197 |
198 | await testFunction(
199 | `getCityByCode(${TEST_CONFIG.SAMPLE_CITY_CODE}) from compiled module`,
200 | () => getCityByCode(TEST_CONFIG.SAMPLE_CITY_CODE),
201 | validateCity
202 | );
203 |
204 | await testFunction(
205 | `getCityByName('${TEST_CONFIG.SAMPLE_CITY_NAME}') from compiled module`,
206 | () => getCityByName(TEST_CONFIG.SAMPLE_CITY_NAME),
207 | validateCity
208 | );
209 |
210 | const regenciesOfProvince = await testFunction(
211 | `getRegenciesOfProvinceCode(${TEST_CONFIG.SAMPLE_PROVINCE_CODE}) from compiled module`,
212 | () => getRegenciesOfProvinceCode(TEST_CONFIG.SAMPLE_PROVINCE_CODE),
213 | (result) => Array.isArray(result) && result.length > 0
214 | );
215 |
216 | if (regenciesOfProvince) {
217 | console.log(` 📍 Found ${regenciesOfProvince.length} cities in province`);
218 | console.log(` 🔍 Examples: ${regenciesOfProvince.slice(0, 3).map(r => r.name).join(', ')}`);
219 | }
220 |
221 | await testFunction(
222 | `getRegenciesOfProvinceName('${TEST_CONFIG.SAMPLE_PROVINCE_NAME}') from compiled module`,
223 | () => getRegenciesOfProvinceName(TEST_CONFIG.SAMPLE_PROVINCE_NAME),
224 | (result) => Array.isArray(result) && result.length > 0
225 | );
226 | }
227 |
228 | console.log('');
229 |
230 | // ===== DISTRICT TESTS =====
231 | log(LogLevel.INFO, 'TESTING DISTRICT FUNCTIONS');
232 | console.log('━'.repeat(50));
233 |
234 | const districts = await testFunction(
235 | 'getAllDistricts() from compiled module',
236 | () => getAllDistricts(),
237 | (result) => Array.isArray(result) && result.length > 0 && validateDistrict(result[0])
238 | );
239 |
240 | if (districts && districts.length > 0) {
241 | console.log(` 📊 Total districts: ${districts.length}`);
242 | console.log(` 🏘️ First district: ${districts[0].name} (${districts[0].code})`);
243 |
244 | await testFunction(
245 | `getDistrictByCode(${TEST_CONFIG.SAMPLE_DISTRICT_CODE}) from compiled module`,
246 | () => getDistrictByCode(TEST_CONFIG.SAMPLE_DISTRICT_CODE),
247 | validateDistrict
248 | );
249 |
250 | await testFunction(
251 | `getDistrictByName('${TEST_CONFIG.SAMPLE_DISTRICT_NAME}') from compiled module`,
252 | () => getDistrictByName(TEST_CONFIG.SAMPLE_DISTRICT_NAME),
253 | validateDistrict
254 | );
255 |
256 | const districtsOfCity = await testFunction(
257 | `getDistrictsOfCityCode(${TEST_CONFIG.SAMPLE_CITY_CODE}) from compiled module`,
258 | () => getDistrictsOfCityCode(TEST_CONFIG.SAMPLE_CITY_CODE),
259 | (result) => Array.isArray(result) && result.length > 0
260 | );
261 |
262 | if (districtsOfCity) {
263 | console.log(` 📍 Found ${districtsOfCity.length} districts in city`);
264 | console.log(` 🔍 Examples: ${districtsOfCity.slice(0, 3).map(d => d.name).join(', ')}`);
265 | }
266 |
267 | await testFunction(
268 | `getDistrictsOfCityName('${TEST_CONFIG.SAMPLE_CITY_NAME}') from compiled module`,
269 | () => getDistrictsOfCityName(TEST_CONFIG.SAMPLE_CITY_NAME),
270 | (result) => Array.isArray(result) && result.length > 0
271 | );
272 | }
273 |
274 | console.log('');
275 |
276 | // ===== VILLAGE TESTS =====
277 | log(LogLevel.INFO, 'TESTING VILLAGE FUNCTIONS');
278 | console.log('━'.repeat(50));
279 |
280 | const villages = await testFunction(
281 | 'getAllVillages() from compiled module',
282 | () => getAllVillages(),
283 | (result) => Array.isArray(result) && result.length > 0 && validateVillage(result[0])
284 | );
285 |
286 | if (villages && villages.length > 0) {
287 | console.log(` 📊 Total villages: ${villages.length}`);
288 | console.log(` 🏡 First village: ${villages[0].name} (${villages[0].code})`);
289 |
290 | await testFunction(
291 | `getVillageByCode(${TEST_CONFIG.SAMPLE_VILLAGE_CODE}) from compiled module`,
292 | () => getVillageByCode(TEST_CONFIG.SAMPLE_VILLAGE_CODE),
293 | validateVillage
294 | );
295 |
296 | await testFunction(
297 | `getVillageByName('${TEST_CONFIG.SAMPLE_VILLAGE_NAME}') from compiled module`,
298 | () => getVillageByName(TEST_CONFIG.SAMPLE_VILLAGE_NAME),
299 | validateVillage
300 | );
301 |
302 | const villagesOfDistrict = await testFunction(
303 | `getVillagesOfDistrictCode(${TEST_CONFIG.SAMPLE_DISTRICT_CODE}) from compiled module`,
304 | () => getVillagesOfDistrictCode(TEST_CONFIG.SAMPLE_DISTRICT_CODE),
305 | (result) => Array.isArray(result) && result.length > 0
306 | );
307 |
308 | if (villagesOfDistrict) {
309 | console.log(` 📍 Found ${villagesOfDistrict.length} villages in district`);
310 | console.log(` 🔍 Examples: ${villagesOfDistrict.slice(0, 3).map(v => v.name).join(', ')}`);
311 | }
312 |
313 | await testFunction(
314 | `getVillagesOfDistrictName('${TEST_CONFIG.SAMPLE_DISTRICT_NAME}') from compiled module`,
315 | () => getVillagesOfDistrictName(TEST_CONFIG.SAMPLE_DISTRICT_NAME),
316 | (result) => Array.isArray(result) && result.length > 0
317 | );
318 | }
319 |
320 | } catch (error) {
321 | log(LogLevel.ERROR, `Unexpected error: ${error.message}`);
322 | testStats.failed++;
323 | }
324 |
325 | // ===== FINAL REPORT =====
326 | const overallEndTime = Date.now();
327 | const memAfter = process.memoryUsage();
328 | testStats.totalTime = overallEndTime - overallStartTime;
329 |
330 | console.log('\n' + '═'.repeat(60));
331 | console.log('📋 COMPILED MODULE TEST SUMMARY');
332 | console.log('═'.repeat(60));
333 | console.log(`✅ Passed: ${testStats.passed}`);
334 | console.log(`❌ Failed: ${testStats.failed}`);
335 | console.log(`⚠️ Skipped: ${testStats.skipped}`);
336 | console.log(`⏱️ Total Time: ${testStats.totalTime}ms`);
337 | console.log(`💾 Memory Used: ${((memAfter.heapUsed - memBefore.heapUsed) / 1024 / 1024).toFixed(2)} MB`);
338 |
339 | const totalTests = testStats.passed + testStats.failed + testStats.skipped;
340 | const successRate = totalTests > 0 ? ((testStats.passed / totalTests) * 100).toFixed(1) : '0';
341 | console.log(`📊 Success Rate: ${successRate}%`);
342 |
343 | if (testStats.failed === 0) {
344 | log(LogLevel.SUCCESS, 'ALL COMPILED MODULE TESTS COMPLETED SUCCESSFULLY! 🎉');
345 | } else {
346 | log(LogLevel.WARNING, `Compiled module tests completed with ${testStats.failed} failures`);
347 | }
348 |
349 | console.log('═'.repeat(60) + '\n');
350 | }
351 |
352 | // ===== EXECUTION =====
353 | if (require.main === module) {
354 | runTests().catch((error) => {
355 | log(LogLevel.ERROR, `Fatal error: ${error.message}`);
356 | process.exit(1);
357 | });
358 | }
359 |
360 | module.exports = {
361 | runTests,
362 | testStats,
363 | TEST_CONFIG
364 | };
--------------------------------------------------------------------------------
/test-project/index.ts:
--------------------------------------------------------------------------------
1 | import {
2 | // Province functions
3 | getAllProvinces,
4 | getProvinceByCode,
5 | getProvinceByName,
6 |
7 | // City/Regency functions
8 | getAllRegencies,
9 | getCityByCode,
10 | getCityByName,
11 | getRegenciesOfProvinceCode,
12 | getRegenciesOfProvinceName,
13 |
14 | // District functions
15 | getAllDistricts,
16 | getDistrictByCode,
17 | getDistrictByName,
18 | getDistrictsOfCityCode,
19 | getDistrictsOfCityName,
20 |
21 | // Village functions
22 | getAllVillages,
23 | getVillageByCode,
24 | getVillageByName,
25 | getVillagesOfDistrictCode,
26 | getVillagesOfDistrictName,
27 |
28 | // Type imports
29 | Province,
30 | City,
31 | District,
32 | Village
33 | } from 'indonesia-nodejs';
34 |
35 | // ===== CONFIGURATION =====
36 | const TEST_CONFIG = {
37 | SAMPLE_PROVINCE_CODE: 11,
38 | SAMPLE_CITY_CODE: 1101,
39 | SAMPLE_DISTRICT_CODE: 110101,
40 | SAMPLE_VILLAGE_CODE: 1101012001,
41 | SAMPLE_PROVINCE_NAME: 'Jakarta',
42 | SAMPLE_CITY_NAME: 'Jakarta Pusat',
43 | SAMPLE_DISTRICT_NAME: 'Bakongan',
44 | SAMPLE_VILLAGE_NAME: 'Keude Bakongan'
45 | };
46 |
47 | // ===== LOGGING UTILITIES =====
48 | enum LogLevel {
49 | INFO = 0,
50 | SUCCESS = 1,
51 | WARNING = 2,
52 | ERROR = 3
53 | }
54 |
55 | function log(level: LogLevel, message: string): void {
56 | const prefixes = ['ℹ️', '✅', '⚠️', '❌'];
57 | const colors = ['\x1b[36m', '\x1b[32m', '\x1b[33m', '\x1b[31m'];
58 | const reset = '\x1b[0m';
59 | console.log(`${colors[level]}${prefixes[level]} ${message}${reset}`);
60 | }
61 |
62 | // ===== VALIDATION UTILITIES =====
63 | function validateProvince(province: any): boolean {
64 | return province &&
65 | typeof province.code === 'number' &&
66 | typeof province.name === 'string';
67 | }
68 |
69 | function validateCity(city: any): boolean {
70 | return city &&
71 | typeof city.code === 'number' &&
72 | typeof city.province_code === 'number' &&
73 | typeof city.name === 'string';
74 | }
75 |
76 | function validateDistrict(district: any): boolean {
77 | return district &&
78 | typeof district.code === 'number' &&
79 | typeof district.city_code === 'number' &&
80 | typeof district.name === 'string';
81 | }
82 |
83 | function validateVillage(village: any): boolean {
84 | return village &&
85 | typeof village.code === 'number' &&
86 | typeof village.district_code === 'number' &&
87 | typeof village.name === 'string';
88 | }
89 |
90 | // ===== TEST STATISTICS =====
91 | interface TestStats {
92 | passed: number;
93 | failed: number;
94 | skipped: number;
95 | totalTime: number;
96 | }
97 |
98 | const testStats: TestStats = {
99 | passed: 0,
100 | failed: 0,
101 | skipped: 0,
102 | totalTime: 0
103 | };
104 |
105 | // ===== INDIVIDUAL TEST FUNCTIONS =====
106 | async function testFunction(
107 | testName: string,
108 | testFunction: () => Promise,
109 | validator?: (result: T) => boolean
110 | ): Promise {
111 | try {
112 | const startTime = Date.now();
113 | const result = await testFunction();
114 | const endTime = Date.now();
115 |
116 | if (validator && !validator(result)) {
117 | log(LogLevel.WARNING, `${testName} - Data validation failed`);
118 | testStats.skipped++;
119 | return null;
120 | }
121 |
122 | log(LogLevel.SUCCESS, `${testName} (${endTime - startTime}ms)`);
123 | testStats.passed++;
124 | return result;
125 | } catch (error) {
126 | log(LogLevel.ERROR, `${testName} - ${(error as Error).message}`);
127 | testStats.failed++;
128 | return null;
129 | }
130 | }
131 |
132 | // ===== MAIN TEST SUITE =====
133 | async function runTests(): Promise {
134 | const overallStartTime = Date.now();
135 |
136 | console.log('\n🚀 ===== INDONESIA-NODEJS LIBRARY TEST SUITE =====\n');
137 |
138 | // Memory monitoring
139 | const memBefore = process.memoryUsage();
140 |
141 | try {
142 | // ===== PROVINCE TESTS =====
143 | log(LogLevel.INFO, 'TESTING PROVINCES');
144 | console.log('━'.repeat(50));
145 |
146 | const provinces = await testFunction(
147 | 'Get all provinces',
148 | () => getAllProvinces(),
149 | (result: Province[]) => Array.isArray(result) && result.length > 0 && validateProvince(result[0])
150 | );
151 |
152 | if (provinces && provinces.length > 0) {
153 | console.log(` 📊 Total provinces: ${provinces.length}`);
154 | console.log(` 🏛️ First province: ${provinces[0].name} (${provinces[0].code})`);
155 |
156 | await testFunction(
157 | `Get province by ID ${TEST_CONFIG.SAMPLE_PROVINCE_CODE}`,
158 | () => getProvinceByCode(TEST_CONFIG.SAMPLE_PROVINCE_CODE),
159 | validateProvince
160 | );
161 |
162 | await testFunction(
163 | `Get province by name '${TEST_CONFIG.SAMPLE_PROVINCE_NAME}'`,
164 | () => getProvinceByName(TEST_CONFIG.SAMPLE_PROVINCE_NAME),
165 | validateProvince
166 | );
167 | }
168 |
169 | console.log('');
170 |
171 | // ===== CITY/REGENCY TESTS =====
172 | log(LogLevel.INFO, 'TESTING CITIES/REGENCIES');
173 | console.log('━'.repeat(50));
174 |
175 | const regencies = await testFunction(
176 | 'Get all regencies',
177 | () => getAllRegencies(),
178 | (result: City[]) => Array.isArray(result) && result.length > 0 && validateCity(result[0])
179 | );
180 |
181 | if (regencies && regencies.length > 0) {
182 | console.log(` 📊 Total regencies: ${regencies.length}`);
183 | console.log(` 🏙️ First regency: ${regencies[0].name} (${regencies[0].code})`);
184 |
185 | await testFunction(
186 | `Get city by ID ${TEST_CONFIG.SAMPLE_CITY_CODE}`,
187 | () => getCityByCode(TEST_CONFIG.SAMPLE_CITY_CODE),
188 | validateCity
189 | );
190 |
191 | await testFunction(
192 | `Get city by name '${TEST_CONFIG.SAMPLE_CITY_NAME}'`,
193 | () => getCityByName(TEST_CONFIG.SAMPLE_CITY_NAME),
194 | validateCity
195 | );
196 |
197 | const regenciesOfProvince = await testFunction(
198 | `Get regencies of province ${TEST_CONFIG.SAMPLE_PROVINCE_CODE}`,
199 | () => getRegenciesOfProvinceCode(TEST_CONFIG.SAMPLE_PROVINCE_CODE),
200 | (result: City[]) => Array.isArray(result) && result.length > 0
201 | );
202 |
203 | if (regenciesOfProvince) {
204 | console.log(` 📍 Found ${regenciesOfProvince.length} cities in province`);
205 | console.log(` 🔍 Examples: ${regenciesOfProvince.slice(0, 3).map(r => r.name).join(', ')}`);
206 | }
207 |
208 | await testFunction(
209 | `Get regencies by province name '${TEST_CONFIG.SAMPLE_PROVINCE_NAME}'`,
210 | () => getRegenciesOfProvinceName(TEST_CONFIG.SAMPLE_PROVINCE_NAME),
211 | (result: City[]) => Array.isArray(result) && result.length > 0
212 | );
213 | }
214 |
215 | console.log('');
216 |
217 | // ===== DISTRICT TESTS =====
218 | log(LogLevel.INFO, 'TESTING DISTRICTS');
219 | console.log('━'.repeat(50));
220 |
221 | const districts = await testFunction(
222 | 'Get all districts',
223 | () => getAllDistricts(),
224 | (result: District[]) => Array.isArray(result) && result.length > 0 && validateDistrict(result[0])
225 | );
226 |
227 | if (districts && districts.length > 0) {
228 | console.log(` 📊 Total districts: ${districts.length}`);
229 | console.log(` 🏘️ First district: ${districts[0].name} (${districts[0].code})`);
230 |
231 | await testFunction(
232 | `Get district by ID ${TEST_CONFIG.SAMPLE_DISTRICT_CODE}`,
233 | () => getDistrictByCode(TEST_CONFIG.SAMPLE_DISTRICT_CODE),
234 | validateDistrict
235 | );
236 |
237 | await testFunction(
238 | `Get district by name '${TEST_CONFIG.SAMPLE_DISTRICT_NAME}'`,
239 | () => getDistrictByName(TEST_CONFIG.SAMPLE_DISTRICT_NAME),
240 | validateDistrict
241 | );
242 |
243 | const districtsOfCity = await testFunction(
244 | `Get districts of city ${TEST_CONFIG.SAMPLE_CITY_CODE}`,
245 | () => getDistrictsOfCityCode(TEST_CONFIG.SAMPLE_CITY_CODE),
246 | (result: District[]) => Array.isArray(result) && result.length > 0
247 | );
248 |
249 | if (districtsOfCity) {
250 | console.log(` 📍 Found ${districtsOfCity.length} districts in city`);
251 | console.log(` 🔍 Examples: ${districtsOfCity.slice(0, 3).map(d => d.name).join(', ')}`);
252 | }
253 |
254 | await testFunction(
255 | `Get districts by city name '${TEST_CONFIG.SAMPLE_CITY_NAME}'`,
256 | () => getDistrictsOfCityName(TEST_CONFIG.SAMPLE_CITY_NAME),
257 | (result: District[]) => Array.isArray(result) && result.length > 0
258 | );
259 | }
260 |
261 | console.log('');
262 |
263 | // ===== VILLAGE TESTS =====
264 | log(LogLevel.INFO, 'TESTING VILLAGES');
265 | console.log('━'.repeat(50));
266 |
267 | const villages = await testFunction(
268 | 'Get all villages',
269 | () => getAllVillages(),
270 | (result: Village[]) => Array.isArray(result) && result.length > 0 && validateVillage(result[0])
271 | );
272 |
273 | if (villages && villages.length > 0) {
274 | console.log(` 📊 Total villages: ${villages.length}`);
275 | console.log(` 🏡 First village: ${villages[0].name} (${villages[0].code})`);
276 |
277 | await testFunction(
278 | `Get village by ID ${TEST_CONFIG.SAMPLE_VILLAGE_CODE}`,
279 | () => getVillageByCode(TEST_CONFIG.SAMPLE_VILLAGE_CODE),
280 | validateVillage
281 | );
282 |
283 | await testFunction(
284 | `Get village by name '${TEST_CONFIG.SAMPLE_VILLAGE_NAME}'`,
285 | () => getVillageByName(TEST_CONFIG.SAMPLE_VILLAGE_NAME),
286 | validateVillage
287 | );
288 |
289 | const villagesOfDistrict = await testFunction(
290 | `Get villages of district ${TEST_CONFIG.SAMPLE_DISTRICT_CODE}`,
291 | () => getVillagesOfDistrictCode(TEST_CONFIG.SAMPLE_DISTRICT_CODE),
292 | (result: Village[]) => Array.isArray(result) && result.length > 0
293 | );
294 |
295 | if (villagesOfDistrict) {
296 | console.log(` 📍 Found ${villagesOfDistrict.length} villages in district`);
297 | console.log(` 🔍 Examples: ${villagesOfDistrict.slice(0, 3).map(v => v.name).join(', ')}`);
298 | }
299 |
300 | await testFunction(
301 | `Get villages by district name '${TEST_CONFIG.SAMPLE_DISTRICT_NAME}'`,
302 | () => getVillagesOfDistrictName(TEST_CONFIG.SAMPLE_DISTRICT_NAME),
303 | (result: Village[]) => Array.isArray(result) && result.length > 0
304 | );
305 | }
306 |
307 | } catch (error) {
308 | log(LogLevel.ERROR, `Unexpected error: ${(error as Error).message}`);
309 | testStats.failed++;
310 | }
311 |
312 | // ===== FINAL REPORT =====
313 | const overallEndTime = Date.now();
314 | const memAfter = process.memoryUsage();
315 | testStats.totalTime = overallEndTime - overallStartTime;
316 |
317 | console.log('\n' + '═'.repeat(60));
318 | console.log('📋 TEST SUMMARY REPORT');
319 | console.log('═'.repeat(60));
320 | console.log(`✅ Passed: ${testStats.passed}`);
321 | console.log(`❌ Failed: ${testStats.failed}`);
322 | console.log(`⚠️ Skipped: ${testStats.skipped}`);
323 | console.log(`⏱️ Total Time: ${testStats.totalTime}ms`);
324 | console.log(`💾 Memory Used: ${((memAfter.heapUsed - memBefore.heapUsed) / 1024 / 1024).toFixed(2)} MB`);
325 |
326 | const totalTests = testStats.passed + testStats.failed + testStats.skipped;
327 | const successRate = totalTests > 0 ? ((testStats.passed / totalTests) * 100).toFixed(1) : '0';
328 | console.log(`📊 Success Rate: ${successRate}%`);
329 |
330 | if (testStats.failed === 0) {
331 | log(LogLevel.SUCCESS, 'ALL TESTS COMPLETED SUCCESSFULLY! 🎉');
332 | } else {
333 | log(LogLevel.WARNING, `Tests completed with ${testStats.failed} failures`);
334 | }
335 |
336 | console.log('═'.repeat(60) + '\n');
337 | }
338 |
339 | // ===== EXECUTION =====
340 | if (require.main === module) {
341 | runTests().catch((error) => {
342 | log(LogLevel.ERROR, `Fatal error: ${error.message}`);
343 | process.exit(1);
344 | });
345 | }
346 |
--------------------------------------------------------------------------------
/test-project/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test-project",
3 | "version": "1.1.0",
4 | "lockfileVersion": 2,
5 | "requires": true,
6 | "packages": {
7 | "": {
8 | "name": "test-project",
9 | "version": "1.1.0",
10 | "license": "ISC",
11 | "dependencies": {
12 | "indonesia-nodejs": "file:../indonesia-nodejs-1.0.8.tgz"
13 | }
14 | },
15 | "node_modules/indonesia-nodejs": {
16 | "version": "1.0.8",
17 | "resolved": "file:../indonesia-nodejs-1.0.8.tgz",
18 | "integrity": "sha512-khZjh2zeyHh672wJKmugICpt4UWvY+ampVuV5iZJEQX12CdzPccsvOLQDtOpQcK32z1dK0oSq1HMKl7EzcBQUA=="
19 | }
20 | },
21 | "dependencies": {
22 | "indonesia-nodejs": {
23 | "version": "file:../indonesia-nodejs-1.0.8.tgz",
24 | "integrity": "sha512-khZjh2zeyHh672wJKmugICpt4UWvY+ampVuV5iZJEQX12CdzPccsvOLQDtOpQcK32z1dK0oSq1HMKl7EzcBQUA=="
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/test-project/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test-project",
3 | "version": "1.1.0",
4 | "main": "index.ts",
5 | "types": "types/index.d.ts",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "description": "",
13 | "dependencies": {
14 | "indonesia-nodejs": "file:../indonesia-nodejs-1.0.8.tgz"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "esModuleInterop": true,
4 | "resolveJsonModule": true,
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "strict": true,
8 | "outDir": "dist",
9 | "rootDir": "src",
10 | "declaration": true
11 | },
12 | "include": ["src"]
13 | }
--------------------------------------------------------------------------------
/types/index.d.ts:
--------------------------------------------------------------------------------
1 | export interface Province {
2 | code: number;
3 | name: string;
4 | }
5 |
6 | export interface City {
7 | code: number;
8 | province_code: number;
9 | name: string;
10 | }
11 |
12 | export interface District {
13 | code: number;
14 | city_code: number;
15 | name: string;
16 | }
17 |
18 | export interface Village {
19 | code: number;
20 | district_code: number;
21 | name: string;
22 | postal_code: number;
23 | }
24 |
25 | export function getAllProvinces(): Promise;
26 | export function getProvinceByCode(code: number): Promise;
27 | export function getProvinceByName(name: string): Promise;
28 |
29 | export function getAllRegencies(): Promise;
30 | export function getCityByCode(code: number): Promise;
31 | export function getCityByName(name: string): Promise;
32 | export function getRegenciesOfProvinceCode(provinceCode: number): Promise;
33 | export function getRegenciesOfProvinceName(provinceName: string): Promise;
34 |
35 | export function getAllDistricts(): Promise;
36 | export function getDistrictByCode(code: number): Promise;
37 | export function getDistrictByName(name: string): Promise;
38 | export function getDistrictsOfCityCode(cityCode: number): Promise;
39 | export function getDistrictsOfCityName(cityName: string): Promise;
40 |
41 | export function getAllVillages(): Promise;
42 | export function getVillageByCode(code: number): Promise;
43 | export function getVillageByName(name: string): Promise;
44 | export function getVillagesOfDistrictCode(districtCode: number): Promise;
45 | export function getVillagesOfDistrictName(districtName: string): Promise;
46 |
--------------------------------------------------------------------------------