geo-sl 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,11 +12,11 @@
12
12
 
13
13
  ## 🗺️ 100% Comprehensive Island-wide Coverage
14
14
 
15
- `geo-sl` is not limited to major metropolitan areas. It provides complete, authoritative, and verified geographic coverage across the entire territory of Sri Lanka—from provincial capitals down to individual rural villages:
15
+ `geo-sl` covers the entire territory of Sri Lanka — not just major cities and urban centers. It provides complete, authoritative, and verified geographic data from provincial capitals all the way down to individual rural villages and remote Grama Niladhari divisions:
16
16
 
17
17
  | Administrative / Geographic Level | Total Count | Scope & Details | Supported Languages |
18
18
  |---|---|---|---|
19
- | **Provinces** | **9** | All 9 provinces (WP, CP, SP, NP, EP, NW, NC, UV, SG) | English, සිංහල, தமிழ் |
19
+ | **Provinces** | **9** | All 9 provinces (WP, CP, SP, NP, EP, NWP, NCP, UP, SGP) | English, සිංහල, தமிழ் |
20
20
  | **Districts** | **25** | All 25 administrative districts across the island | English, සිංහල, தமிழ் |
21
21
  | **Divisional Secretariats (DSD)** | **340** | 100% of Divisional Secretariat Divisions (MOHA) | English, සිංහල, தமிழ் |
22
22
  | **Grama Niladhari (GN) Divisions** | **14,020** | Every single village, ward, and local community | English, සිංහල, தமிழ் |
@@ -92,7 +92,7 @@ getPostalCode('මහනුවර'); // => "20000"
92
92
  // 5. Search with Relevance Ranking
93
93
  search('colombo'); // => [ { name_en: 'Colombo 1', ... }, { name_en: 'Colombo 2', ... } ]
94
94
  search('nawala'); // => [ { name_en: 'Nawala', ... }, ... ]
95
- search('කොළඹ'); // Sinhala search
95
+ search('කොළඹ'); // => [ { name_en: 'Colombo 1', ... }, ... ] (Sinhala search)
96
96
  ```
97
97
 
98
98
  ---
@@ -121,7 +121,7 @@ import { BANKS, getBanks, getBankByCode, getBranches } from 'geo-sl/banks';
121
121
  import { GN_DIVISIONS, getGNDivisions, searchGN } from 'geo-sl/gn';
122
122
 
123
123
  // Validators & Parsers (~2.3 KB)
124
- import { validateNIC, parseNIC, validatePhone, parsePhone, validatePostalCode } from 'geo-sl/validators';
124
+ import { validateNIC, parseNIC, convertOldNICToNew, validatePhone, parsePhone, formatPhone, validatePostalCode } from 'geo-sl/validators';
125
125
  ```
126
126
 
127
127
  ---
@@ -209,7 +209,7 @@ const allBanks = getBanks();
209
209
 
210
210
  // Find Bank of Ceylon
211
211
  const boc = getBankByCode('7010');
212
- console.log(boc.name); // "Bank of Ceylon"
212
+ console.log(boc?.name); // "Bank of Ceylon"
213
213
 
214
214
  // Get all branches for a bank
215
215
  const branches = getBranches('7010');
@@ -222,12 +222,16 @@ const branches = getBranches('7010');
222
222
 
223
223
  ### Provinces
224
224
  * `getProvinces(options?: { lang?: 'en' | 'si' | 'ta' }): Province[]`
225
- * `getProvinceByCode(code: string, options?: { lang?: 'en' | 'si' | 'ta' }): Province | undefined`
225
+ * `getProvince(codeOrId: string): Province | undefined` primary lookup by code (e.g. `'WP'`), ID, or English name.
226
+ * `getProvinceName(codeOrId: string, lang?: Language): string | undefined`
227
+ * `getProvinceByCode(code: string, options?: { lang?: 'en' | 'si' | 'ta' }): Province | undefined` – alias for `getProvince`
226
228
 
227
229
  ### Districts
228
230
  * `getDistricts(province?: string, options?: { lang?: 'en' | 'si' | 'ta' }): District[]`
229
- * `getDistrictByCode(code: string, options?: { lang?: 'en' | 'si' | 'ta' }): District | undefined`
231
+ * `getDistrict(codeOrId: string): District | undefined` primary lookup by abbreviation (e.g. `'CO'`), ID, or English name.
232
+ * `getDistrictName(codeOrId: string, lang?: Language): string | undefined`
230
233
  * `getDistrictsByProvince(province: string, options?: { lang?: 'en' | 'si' | 'ta' }): District[]`
234
+ * `getDistrictByCode(code: string, options?: { lang?: 'en' | 'si' | 'ta' }): District | undefined` – alias for `getDistrict`
231
235
 
232
236
  ### Cities & Postal Codes
233
237
  * `getCities(district?: string, options?: { lang?: 'en' | 'si' | 'ta' }): City[]`
@@ -235,9 +239,9 @@ const branches = getBranches('7010');
235
239
  * `getCitiesByProvince(province: string, options?: { lang?: 'en' | 'si' | 'ta' }): City[]`
236
240
  * `getPostalCode(cityName: string): string | undefined`
237
241
  * `getCityByPostalCode(postalCode: string | number, lang?: 'en' | 'si' | 'ta'): City | undefined`
238
- * `isValidPostalCode(postalCode: string | number): boolean`
239
- * `lookupPostalCode(code: string | number, options?: { lang?: 'en' | 'si' | 'ta' }): City | undefined`
240
- * `lookupAllByPostalCode(code: string | number, options?: { lang?: 'en' | 'si' | 'ta' }): City[]`
242
+ * `isValidPostalCode(postalCode: string | number): boolean` – checks existence against the Sri Lanka Post database.
243
+ * `lookupPostalCode(code: string | number, options?: { lang?: 'en' | 'si' | 'ta' }): City | undefined` – alias for `getCityByPostalCode`
244
+ * `lookupAllByPostalCode(code: string | number, options?: { lang?: 'en' | 'si' | 'ta' }): City[]` – returns all offices sharing a postal code.
241
245
  * `search(query: string, options?: { limit?: number; lang?: 'en' | 'si' | 'ta'; district?: string; province?: string }): City[]`
242
246
 
243
247
  ### Cascading Hierarchy
@@ -246,11 +250,13 @@ const branches = getBranches('7010');
246
250
  ### Administrative Divisions (MOHA)
247
251
  * `getDivisions(district?: string, options?: { lang?: 'en' | 'si' | 'ta' }): Division[]`
248
252
  * `getDivisionsByDistrict(district: string, options?: { lang?: 'en' | 'si' | 'ta' }): Division[]`
253
+ * `getDivisionsByProvince(province: string, options?: { lang?: 'en' | 'si' | 'ta' }): Division[]`
249
254
 
250
255
  ### Financial Institutions (CBSL / LankaPay)
251
- * `getBanks(): Bank[]`
252
- * `getBankByCode(code: string | number): Bank | undefined`
253
- * `getBranches(bankCode: string | number): Branch[]`
256
+ * `getBanks(): readonly Bank[]`
257
+ * `getBank(codeOrId: string | number): Bank | undefined` – primary lookup by 4-digit CBSL code, ID, or bank name.
258
+ * `getBankByCode(codeOrId: string | number): Bank | undefined` – alias for `getBank`
259
+ * `getBranches(bankCode: string | number): readonly Branch[]`
254
260
  * `getBranchByCode(bankCode: string | number, branchCode: string | number): Branch | undefined`
255
261
  * `searchBranches(bankCode: string | number, query: string): Branch[]`
256
262
 
@@ -264,7 +270,7 @@ const branches = getBranches('7010');
264
270
  ### Sri Lanka Validators & Parsers (`geo-sl/validators`)
265
271
  * `validateNIC(nic: string): boolean`
266
272
  * `parseNIC(nic: string): ParsedNIC | null` – parses birthdate, gender, age, voter eligibility from Old (9+V/X) and New (12 digits) NICs.
267
- * `convertOldNICToNew(oldNic: string): string | null` – converts 9-digit old NIC to 12-digit format.
273
+ * `convertOldNICToNew(oldNic: string): string | null` – converts 10-character old NIC (9 digits + V/X) to 12-digit new format.
268
274
  * `validatePhone(phone: string): boolean`
269
275
  * `parsePhone(phone: string): ParsedPhone | null` – parses operator (Dialog, Mobitel, Hutch, Airtel), type (mobile/fixed), and formats.
270
276
  * `formatPhone(phone: string, style?: 'international' | 'local' | 'e164'): string | null`