geo-sl 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/README.md +43 -47
  2. package/package.json +13 -16
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # 🇱🇰 sl-geo
1
+ # 🇱🇰 geo-sl
2
2
 
3
3
  > Trilingual (**English**, **සිංහල**, **தமிழ்**) Sri Lanka geographic, postal code, and administrative dataset for TypeScript & JavaScript with zero runtime dependencies.
4
4
 
5
- [![npm version](https://img.shields.io/npm/v/sl-geo.svg)](https://www.npmjs.com/package/sl-geo)
5
+ [![npm version](https://img.shields.io/npm/v/geo-sl.svg)](https://www.npmjs.com/package/geo-sl)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
  [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen.svg)]()
8
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue)]()
@@ -10,37 +10,41 @@
10
10
 
11
11
  ---
12
12
 
13
- ## Features
14
-
15
- - **Zero Runtime Dependencies** Pure TypeScript with pre-indexed datasets and type definitions.
16
- - **Complete Administrative & Postal Coverage**:
17
- - **2,500+ Post Offices & 5-digit Postal Codes** from the Department of Posts (`slpost.gov.lk`).
18
- - **9 Provinces, 25 Districts, 340 Divisional Secretariats (DSD)** from the Ministry of Home Affairs (`moha.gov.lk`).
19
- - **14,000+ Grama Niladhari (GN) divisions** available via dedicated subpath export (`sl-geo/gn`).
20
- - **Official Bank Codes & Branch Codes** from the Central Bank of Sri Lanka (`cbsl.gov.lk`) / LankaPay via (`sl-geo/banks`).
21
- - **GPS Latitude & Longitude** centroids for 2,100+ cities and towns.
22
- - **Trilingual Support** Complete coverage across **English**, **Sinhala (සිංහල)**, and **Tamil (தமிழ்)**.
23
- - **Modular Subpath Exports** Optimized for tree-shaking:
24
- - `sl-geo/provinces`
25
- - `sl-geo/districts`
26
- - `sl-geo/cities`
27
- - `sl-geo/divisions`
28
- - `sl-geo/banks`
29
- - `sl-geo/gn`
30
- - `sl-geo/validators`
31
- - **Cascading Hierarchy Helper** – Built-in utility for multi-level Province District City form selectors.
32
- - **Relevance-Ranked Search** – Multi-lingual search matching by English name, Sinhala, Tamil, and 5-digit postal code with exact/prefix prioritization.
13
+ ## 🗺️ 100% Comprehensive Island-wide Coverage
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:
16
+
17
+ | Administrative / Geographic Level | Total Count | Scope & Details | Supported Languages |
18
+ |---|---|---|---|
19
+ | **Provinces** | **9** | All 9 provinces (WP, CP, SP, NP, EP, NW, NC, UV, SG) | English, සිංහල, தமிழ் |
20
+ | **Districts** | **25** | All 25 administrative districts across the island | English, සිංහල, தமிழ் |
21
+ | **Divisional Secretariats (DSD)** | **340** | 100% of Divisional Secretariat Divisions (MOHA) | English, සිංහල, தமிழ் |
22
+ | **Grama Niladhari (GN) Divisions** | **14,020** | Every single village, ward, and local community | English, සිංහල, தமிழ் |
23
+ | **Cities, Towns & Post Offices** | **2,598** | Main post offices, towns, and sub-post offices | English, සිංහල, தமிழ் |
24
+ | **GPS Centroids** | **2,100+** | Accurate Latitude & Longitude coordinates | WGS84 coordinates |
25
+ | **Licensed Banks & Branches** | **45 Banks / 582+ Branches** | Complete CBSL & LankaPay routing codes | Official routing codes |
26
+
27
+ ---
28
+
29
+ ## ⚡ Key Highlights
30
+
31
+ - **Zero Runtime Dependencies** – Pure TypeScript with pre-indexed lookup maps. Ultra-fast, deterministic performance.
32
+ - **Trilingual First-Class Support** – Seamless lookups in **English**, **Sinhala (සිංහල)**, and **Tamil (தமிழ்)** with native scripts.
33
+ - **Optimized Subpath Tree-Shaking** – Import only what you need. Lightweight modules like validators are only **~2.3 KB**.
34
+ - **Cascading Form Helper** – Out-of-the-box hierarchy builder (`Province ➔ District ➔ City`) for checkout address selectors.
35
+ - **Intelligent Relevance Search** – Multi-lingual search prioritizing exact matches, prefixes, and postal codes over broad substring matches.
36
+ - **Built-in Validators & Parsers** – National Identity Card (Old 9-digit + New 12-digit NIC), Sri Lankan mobile & landline phone numbers, and postal codes.
33
37
 
34
38
  ---
35
39
 
36
40
  ## Installation
37
41
 
38
42
  ```bash
39
- npm install sl-geo
43
+ npm install geo-sl
40
44
  # or
41
- pnpm add sl-geo
45
+ pnpm add geo-sl
42
46
  # or
43
- yarn add sl-geo
47
+ yarn add geo-sl
44
48
  ```
45
49
 
46
50
  ---
@@ -58,7 +62,7 @@ import {
58
62
  PROVINCE_MAP,
59
63
  DISTRICT_MAP,
60
64
  search
61
- } from 'sl-geo';
65
+ } from 'geo-sl';
62
66
 
63
67
  // 1. Province Lookup
64
68
  const wp = getProvince('WP');
@@ -99,25 +103,25 @@ To keep client bundles minimal, import only the modules your application needs:
99
103
 
100
104
  ```typescript
101
105
  // Provinces only (~2 KB)
102
- import { PROVINCES, getProvinces, getProvince } from 'sl-geo/provinces';
106
+ import { PROVINCES, getProvinces, getProvince } from 'geo-sl/provinces';
103
107
 
104
108
  // Districts only (~7 KB)
105
- import { DISTRICTS, getDistricts, getDistrictsByProvince } from 'sl-geo/districts';
109
+ import { DISTRICTS, getDistricts, getDistrictsByProvince } from 'geo-sl/districts';
106
110
 
107
111
  // Cities & Postal Codes (~900 KB)
108
- import { CITIES, getCityByPostalCode, getPostalCode, search } from 'sl-geo/cities';
112
+ import { CITIES, getCityByPostalCode, getPostalCode, search } from 'geo-sl/cities';
109
113
 
110
114
  // Divisional Secretariats (~68 KB)
111
- import { DIVISIONS, getDivisions, getDivisionsByDistrict } from 'sl-geo/divisions';
115
+ import { DIVISIONS, getDivisions, getDivisionsByDistrict } from 'geo-sl/divisions';
112
116
 
113
117
  // CBSL Bank & Branch Codes (~140 KB)
114
- import { BANKS, getBanks, getBankByCode, getBranches } from 'sl-geo/banks';
118
+ import { BANKS, getBanks, getBankByCode, getBranches } from 'geo-sl/banks';
115
119
 
116
120
  // Grama Niladhari Divisions (14,000+ entries, ~3 MB)
117
- import { GN_DIVISIONS, getGNDivisions, searchGN } from 'sl-geo/gn';
121
+ import { GN_DIVISIONS, getGNDivisions, searchGN } from 'geo-sl/gn';
118
122
 
119
123
  // Validators & Parsers (~2.3 KB)
120
- import { validateNIC, parseNIC, validatePhone, parsePhone, validatePostalCode } from 'sl-geo/validators';
124
+ import { validateNIC, parseNIC, validatePhone, parsePhone, validatePostalCode } from 'geo-sl/validators';
121
125
  ```
122
126
 
123
127
  ---
@@ -128,7 +132,7 @@ The easiest way to build a Sri Lankan checkout address form:
128
132
 
129
133
  ```tsx
130
134
  import React, { useState } from 'react';
131
- import { getCascadingData } from 'sl-geo';
135
+ import { getCascadingData } from 'geo-sl';
132
136
 
133
137
  const addressData = getCascadingData({ lang: 'en' });
134
138
 
@@ -193,12 +197,12 @@ export function SriLankaAddressForm() {
193
197
 
194
198
  ---
195
199
 
196
- ## 🏦 CBSL Bank & Branch Codes (`sl-geo/banks`)
200
+ ## 🏦 CBSL Bank & Branch Codes (`geo-sl/banks`)
197
201
 
198
202
  Essential for fintech, payment gateway integrations, and bank transfer checkouts:
199
203
 
200
204
  ```typescript
201
- import { getBanks, getBankByCode, getBranches } from 'sl-geo/banks';
205
+ import { getBanks, getBankByCode, getBranches } from 'geo-sl/banks';
202
206
 
203
207
  // List all licensed banks
204
208
  const allBanks = getBanks();
@@ -250,14 +254,14 @@ const branches = getBranches('7010');
250
254
  * `getBranchByCode(bankCode: string | number, branchCode: string | number): Branch | undefined`
251
255
  * `searchBranches(bankCode: string | number, query: string): Branch[]`
252
256
 
253
- ### Grama Niladhari (GN) Divisions (`sl-geo/gn`)
257
+ ### Grama Niladhari (GN) Divisions (`geo-sl/gn`)
254
258
  * `getGNDivisions(options?: { lang?: 'en' | 'si' | 'ta' }): GNDivision[]`
255
259
  * `getGNDivisionsByDSD(divisionName: string, options?: { lang?: 'en' | 'si' | 'ta' }): GNDivision[]`
256
260
  * `getGNDivisionsByDistrict(districtName: string, options?: { lang?: 'en' | 'si' | 'ta' }): GNDivision[]`
257
261
  * `findGNByCode(code: string, options?: { lang?: 'en' | 'si' | 'ta' }): GNDivision | undefined`
258
262
  * `searchGN(query: string, options?: { limit?: number; lang?: 'en' | 'si' | 'ta'; district?: string; division?: string }): GNDivision[]`
259
263
 
260
- ### Sri Lanka Validators & Parsers (`sl-geo/validators`)
264
+ ### Sri Lanka Validators & Parsers (`geo-sl/validators`)
261
265
  * `validateNIC(nic: string): boolean`
262
266
  * `parseNIC(nic: string): ParsedNIC | null` – parses birthdate, gender, age, voter eligibility from Old (9+V/X) and New (12 digits) NICs.
263
267
  * `convertOldNICToNew(oldNic: string): string | null` – converts 9-digit old NIC to 12-digit format.
@@ -286,19 +290,11 @@ import type {
286
290
  DistrictCode,
287
291
  QueryOptions,
288
292
  SearchOptions
289
- } from 'sl-geo';
293
+ } from 'geo-sl';
290
294
  ```
291
295
 
292
296
  ---
293
297
 
294
- ## 🏛️ Data Sources & Attribution
295
-
296
- - **Postal Data**: [Department of Posts, Sri Lanka](https://slpost.gov.lk)
297
- - **Administrative Hierarchy**: [Ministry of Public Administration & Home Affairs](http://moha.gov.lk) & [Department of Census and Statistics](http://www.statistics.gov.lk)
298
- - **Bank & Branch Codes**: [Central Bank of Sri Lanka](https://www.cbsl.gov.lk) & [LankaPay](https://www.lankapay.net)
299
-
300
- ---
301
-
302
298
  ## 📄 License
303
299
 
304
300
  MIT © [Mahesh Abeykoon](https://github.com/mahesh-abeykoon)
package/package.json CHANGED
@@ -1,16 +1,19 @@
1
1
  {
2
2
  "name": "geo-sl",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Trilingual (English, සිංහල, தமிழ்) Sri Lanka geographic, postal code, and administrative dataset for TypeScript and JavaScript.",
5
5
  "author": "Mahesh Abeykoon",
6
6
  "license": "MIT",
7
- "homepage": "https://github.com/mahesh-abeykoon/sl-geo#readme",
7
+ "homepage": "https://github.com/mahesh-abeykoon/geo-sl#readme",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/mahesh-abeykoon/sl-geo.git"
10
+ "url": "git+https://github.com/mahesh-abeykoon/geo-sl.git"
11
11
  },
12
12
  "bugs": {
13
- "url": "https://github.com/mahesh-abeykoon/sl-geo/issues"
13
+ "url": "https://github.com/mahesh-abeykoon/geo-sl/issues"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
14
17
  },
15
18
  "sideEffects": false,
16
19
  "engines": {
@@ -116,21 +119,15 @@
116
119
  "dist"
117
120
  ],
118
121
  "keywords": [
119
- "sri lanka",
120
- "postal code",
121
- "postcode",
122
+ "sri-lanka",
123
+ "geo",
124
+ "postal-codes",
122
125
  "cities",
123
126
  "districts",
124
127
  "provinces",
125
- "divisional secretariat",
126
- "grama niladhari",
127
- "colombo",
128
- "sinhala",
129
- "tamil",
130
- "lankapay",
131
- "banks",
132
- "address autocomplete",
133
- "checkout"
128
+ "administrative-divisions",
129
+ "grama-niladhari",
130
+ "bank-codes"
134
131
  ],
135
132
  "scripts": {
136
133
  "build:data": "node scripts/build-datasets.mjs",