pakdatakit 2.1.2 → 2.2.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.
- package/DATA.md +105 -0
- package/README.md +94 -9
- package/dist/address.cjs +4 -4
- package/dist/address.d.cts +2 -1
- package/dist/address.d.ts +2 -1
- package/dist/address.js +2 -2
- package/dist/{chunk-PHHKIMO2.cjs → chunk-33FXHM2E.cjs} +5 -5
- package/dist/{chunk-3COX5FSL.cjs → chunk-34CJGJ67.cjs} +53 -6
- package/dist/chunk-3IARSCO6.cjs +317 -0
- package/dist/{chunk-BSS4Z7NI.cjs → chunk-3ZA265SK.cjs} +2 -2
- package/dist/{chunk-AUATLZA5.cjs → chunk-47P7HILD.cjs} +4 -4
- package/dist/{chunk-Q7XHVR3U.cjs → chunk-4VSGCQ6K.cjs} +86 -15
- package/dist/{chunk-Y6BUGLXU.js → chunk-6IPPANNX.js} +4 -1
- package/dist/{chunk-L45UXUWX.js → chunk-AZV45DMG.js} +1 -1
- package/dist/{chunk-QQQKISXT.js → chunk-BR4QLZPX.js} +11 -2
- package/dist/{chunk-K6CZFCX6.js → chunk-E6DT2DWQ.js} +53 -6
- package/dist/{chunk-P4CGOJEM.js → chunk-EMH4IP2U.js} +1 -1
- package/dist/{chunk-JNP27XW2.cjs → chunk-GJENL6VK.cjs} +6 -6
- package/dist/{chunk-APXP7OK7.cjs → chunk-HIZQBWNW.cjs} +11 -2
- package/dist/{chunk-YS7MOLK2.cjs → chunk-HTERSQGF.cjs} +3 -3
- package/dist/{chunk-E7GAK72W.js → chunk-HUQY2WR5.js} +3 -3
- package/dist/{chunk-KQKW2ZEK.cjs → chunk-NAJGGUAM.cjs} +2 -2
- package/dist/{chunk-YLWZGSFY.cjs → chunk-NTD4JLDW.cjs} +4 -0
- package/dist/{chunk-R7UTY3SY.js → chunk-NZQ47NWD.js} +84 -14
- package/dist/{chunk-432ZYMYV.js → chunk-PLDVGOKZ.js} +2 -2
- package/dist/{chunk-L2BDDM2W.js → chunk-QKH7W2CC.js} +1 -1
- package/dist/{chunk-T3E4B5MJ.js → chunk-RXNYY5K5.js} +1 -1
- package/dist/chunk-TTARJWGT.js +82 -0
- package/dist/chunk-U7MWHXMF.cjs +89 -0
- package/dist/chunk-YPPKY5XZ.js +312 -0
- package/dist/cli.js +1 -1
- package/dist/cnic.d.cts +2 -1
- package/dist/cnic.d.ts +2 -1
- package/dist/geo.cjs +6 -6
- package/dist/geo.js +1 -1
- package/dist/hijri.d.cts +2 -1
- package/dist/hijri.d.ts +2 -1
- package/dist/holidays.d.cts +4 -2
- package/dist/holidays.d.ts +4 -2
- package/dist/iban.cjs +11 -3
- package/dist/iban.d.cts +46 -1
- package/dist/iban.d.ts +46 -1
- package/dist/iban.js +1 -1
- package/dist/index.cjs +76 -37
- package/dist/index.d.cts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +16 -10
- package/dist/input.cjs +34 -0
- package/dist/input.d.cts +68 -0
- package/dist/input.d.ts +68 -0
- package/dist/input.js +5 -0
- package/dist/networks.cjs +3 -3
- package/dist/networks.d.cts +2 -1
- package/dist/networks.d.ts +2 -1
- package/dist/networks.js +2 -2
- package/dist/numbers.cjs +6 -6
- package/dist/numbers.d.cts +2 -1
- package/dist/numbers.d.ts +2 -1
- package/dist/numbers.js +2 -2
- package/dist/phone.cjs +8 -8
- package/dist/phone.d.cts +2 -1
- package/dist/phone.d.ts +2 -1
- package/dist/phone.js +3 -3
- package/dist/raast.cjs +9 -5
- package/dist/raast.d.cts +54 -8
- package/dist/raast.d.ts +54 -8
- package/dist/raast.js +2 -2
- package/dist/tax.d.cts +2 -1
- package/dist/tax.d.ts +2 -1
- package/dist/valibot.cjs +7 -7
- package/dist/valibot.js +6 -6
- package/dist/whatsapp.cjs +3 -3
- package/dist/whatsapp.js +2 -2
- package/dist/words.cjs +3 -3
- package/dist/words.d.cts +2 -1
- package/dist/words.d.ts +2 -1
- package/dist/words.js +1 -1
- package/dist/yup.cjs +7 -7
- package/dist/yup.js +6 -6
- package/dist/zod.cjs +7 -7
- package/dist/zod.js +6 -6
- package/package.json +24 -11
- package/dist/chunk-4EUKCSLW.js +0 -221
- package/dist/chunk-E47SNBWQ.cjs +0 -224
package/DATA.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Data sources
|
|
2
|
+
|
|
3
|
+
PakDataKit's datasets live in `data/` and are generated by
|
|
4
|
+
`scripts/generate-data.mjs` (except `networks.json`, `area-codes.json` and
|
|
5
|
+
`holidays.json`, which are edited directly). The exported `dataVersion` is the
|
|
6
|
+
date the data was last checked.
|
|
7
|
+
|
|
8
|
+
**Data version: 2026-11-07**
|
|
9
|
+
|
|
10
|
+
Official bodies (PTA, NADRA, SBP, Pakistan Post) publish few machine-readable
|
|
11
|
+
lists, so some entries rest on secondary sources. Each section says how sure we
|
|
12
|
+
are. To correct an entry, open an issue or pull request with a source.
|
|
13
|
+
|
|
14
|
+
## Banks (`banks.json`): IBAN bank codes
|
|
15
|
+
|
|
16
|
+
SBP does not publish a list of IBAN bank codes, and IBAN codes do not always
|
|
17
|
+
match SWIFT BIC prefixes (e.g. Silkbank is `SAUD`). Codes are therefore checked
|
|
18
|
+
against real IBANs.
|
|
19
|
+
|
|
20
|
+
- **Confirmed from real IBANs:** most commercial and microfinance banks, from
|
|
21
|
+
SBP's account lists for the 2022 flood relief fund and the 2023 Türkiye–Syria
|
|
22
|
+
earthquake relief fund, plus charity donation pages (TCF, Alkhidmat). This
|
|
23
|
+
includes `KHBL` (Khushhali), `JCMA` and `WMBL` (Mobilink Bank), `TMFB`
|
|
24
|
+
(easypaisa), `FMFB` (HBL Microfinance), `FINC` (ABHI), `UMBL`, `NRSP`,
|
|
25
|
+
`APNA`, `BKCH`, `ICBK`, `CITI`, `SUMB` (Bank Makramah), `SAMB`, `SMES` and
|
|
26
|
+
`SAUD`.
|
|
27
|
+
- **Confirmed from published IBANs on smaller sites:** `SADA` (SadaPay), `NAYA`
|
|
28
|
+
(NayaPay).
|
|
29
|
+
- **Confirmed from real account IBANs shared by a maintainer:** `RQMI` (Raqami
|
|
30
|
+
Islamic Digital Bank) and `MSHQ` (Mashreq Bank Pakistan), both digital banks.
|
|
31
|
+
- **Likely, not confirmed by a real IBAN:** `DEUT` (Deutsche Bank), `SBPP`
|
|
32
|
+
(State Bank of Pakistan).
|
|
33
|
+
- **Not included, because no code could be confirmed:** HugoBank (in pilot,
|
|
34
|
+
not yet issuing IBANs), KT Bank (reportedly renamed Buraq Bank), LOLC Microfinance
|
|
35
|
+
(formerly Pak Oman), Zarai Taraqiati Bank and Bank of AJK.
|
|
36
|
+
- **Merged or renamed** banks keep their code with the current name, e.g.
|
|
37
|
+
`SAUD` → "Silkbank Limited (merged into United Bank Limited)".
|
|
38
|
+
|
|
39
|
+
## Mobile networks (`networks.json`)
|
|
40
|
+
|
|
41
|
+
`03XX` prefixes and the operator each was originally allocated to. PTA does not
|
|
42
|
+
publish an allocation table; prefixes are cross-checked with Google
|
|
43
|
+
libphonenumber and operator announcements.
|
|
44
|
+
|
|
45
|
+
- `0329` (Jazz) and `0355` (SCO) included.
|
|
46
|
+
- `0370`–`0371` (Zong) included; `0372`–`0379` are **not**, as no allocation or
|
|
47
|
+
use was found.
|
|
48
|
+
- `0364` (Instaphone, licence cancelled in 2008) is not included.
|
|
49
|
+
- `034x` is labelled Telenor, the original allocation; Telenor Pakistan merged
|
|
50
|
+
into PTML (Ufone) in 2026. With number portability, the current operator can
|
|
51
|
+
differ for any prefix.
|
|
52
|
+
|
|
53
|
+
## Landline area codes (`area-codes.json`)
|
|
54
|
+
|
|
55
|
+
From PTCL's national dialling-code list, cross-checked with libphonenumber's
|
|
56
|
+
geocoding data. Muzaffarabad, Mirpur and Gilgit codes are left out because only
|
|
57
|
+
third-party sources give them. Number patterns in `numbers.ts` come from
|
|
58
|
+
libphonenumber's PK metadata (v9.0.41).
|
|
59
|
+
|
|
60
|
+
## Districts (`districts.json`)
|
|
61
|
+
|
|
62
|
+
177 districts as of October 2026: Punjab 41, Sindh 30, Khyber Pakhtunkhwa 40,
|
|
63
|
+
Balochistan 41, Gilgit-Baltistan 14, Azad Jammu and Kashmir 10, Islamabad 1.
|
|
64
|
+
|
|
65
|
+
- **Khyber Pakhtunkhwa** (APP, January 2026: "increased to 40"): Lower and Upper
|
|
66
|
+
South Waziristan (2022), Central Dir and Allai (January 2023), Paharpur
|
|
67
|
+
(November 2025), Bar Swat (January 2026; reported as "Upper Swat" before
|
|
68
|
+
the Board of Revenue notification of 27 January 2026).
|
|
69
|
+
- **Balochistan** (Revenue Department notification, 8 July 2026; Dawn,
|
|
70
|
+
ProPakistani): Quetta split into Quetta East and Quetta West; Dera Bugti
|
|
71
|
+
became South Dera Bugti and Upper Dera Bugti became North Dera Bugti; new
|
|
72
|
+
Barshore, Tump and Wadh districts; Hub and Usta Muhammad (2022). Taftan is not
|
|
73
|
+
included: no notification was found and the official count of 41 is reached
|
|
74
|
+
without it.
|
|
75
|
+
- **Punjab:** Taunsa, Kot Addu, Murree, Wazirabad and Talagang (2022). A 2026
|
|
76
|
+
notification of four more districts was confirmed fake.
|
|
77
|
+
- **Sindh:** proposed Karachi district renames (2024) were not found notified,
|
|
78
|
+
so current names are kept.
|
|
79
|
+
- Former names (Quetta, Dera Bugti, Upper Dera Bugti, South Waziristan, Upper
|
|
80
|
+
Swat) still resolve in `getDistrictProvince`.
|
|
81
|
+
|
|
82
|
+
## Cities (`cities.json`)
|
|
83
|
+
|
|
84
|
+
District headquarters and major towns, plus every city that has a postal code
|
|
85
|
+
in `postal-codes.json`, each mapped to its province.
|
|
86
|
+
|
|
87
|
+
## Postal codes (`postal-codes.json`)
|
|
88
|
+
|
|
89
|
+
Principal post office codes for major cities (109 entries). Pakistan Post has no
|
|
90
|
+
downloadable dataset, only a lookup tool, so coverage is limited.
|
|
91
|
+
|
|
92
|
+
## Public holidays (`holidays.json`)
|
|
93
|
+
|
|
94
|
+
Eid ul Fitr, Eid ul Adha, Ashura and Eid Milad un Nabi dates actually observed
|
|
95
|
+
in 2020–2026, from Cabinet Division notifications and SBP circulars; each entry
|
|
96
|
+
has a `source` URL. Later years are estimated from the tabular Hijri calendar
|
|
97
|
+
and marked `estimated: true`. Fixed-date holidays follow the years they applied
|
|
98
|
+
in (e.g. Iqbal Day restored in 2022, Youm-e-Takbeer from 2024).
|
|
99
|
+
|
|
100
|
+
## CNIC
|
|
101
|
+
|
|
102
|
+
First digit = province of registration, per FBR's tax-ID description filed with
|
|
103
|
+
the OECD (1 Khyber Pakhtunkhwa, 2 former FATA, 3 Punjab, 4 Sindh, 5
|
|
104
|
+
Balochistan, 6 Islamabad, 7 Gilgit-Baltistan). `8` for Azad Jammu and Kashmir
|
|
105
|
+
comes from secondary sources only. Last digit odd = male, even = female.
|
package/README.md
CHANGED
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
<a href="https://pakdatakit-playground.vercel.app/">
|
|
25
25
|
<img src="https://img.shields.io/badge/playground-try%20it%20live-brightgreen" alt="Playground">
|
|
26
26
|
</a>
|
|
27
|
+
<a href="https://chmuzamil.github.io/pakdatakit/">
|
|
28
|
+
<img src="https://img.shields.io/badge/docs-API%20reference-blue" alt="API docs">
|
|
29
|
+
</a>
|
|
27
30
|
</p>
|
|
28
31
|
|
|
29
32
|
---
|
|
@@ -38,6 +41,29 @@ Validate CNICs, analyze phone numbers, detect networks, build WhatsApp links, ch
|
|
|
38
41
|
|
|
39
42
|
---
|
|
40
43
|
|
|
44
|
+
## 📦 Packages
|
|
45
|
+
|
|
46
|
+
| Package | Install | For |
|
|
47
|
+
| --------------------------------------------------------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------- |
|
|
48
|
+
| [`pakdatakit`](https://www.npmjs.com/package/pakdatakit) | `npm install pakdatakit` | JavaScript and TypeScript (Node, browsers, Bun, Deno) |
|
|
49
|
+
| [`pakdatakit` (Python)](https://github.com/chmuzamil/pakdatakit/tree/main/python) | `pip install pakdatakit` | Python 3.9+, same functions in snake_case, same data |
|
|
50
|
+
| [`pakdatakit-react`](https://github.com/chmuzamil/pakdatakit/tree/main/react) | `npm install pakdatakit-react` | React inputs that format as you type, and a Raast QR component |
|
|
51
|
+
| [`pakdatakit-faker`](https://github.com/chmuzamil/pakdatakit/tree/main/faker) | `npm install -D pakdatakit-faker` | Seeded mock data: CNICs, phones, IBANs, addresses and whole personas that pass every validator |
|
|
52
|
+
| [`pakdatakit` (Dart)](https://github.com/chmuzamil/pakdatakit/tree/main/dart) | `dart pub add pakdatakit` | Dart and Flutter (including web), same functions and data |
|
|
53
|
+
| [`pakdatakit_flutter`](https://github.com/chmuzamil/pakdatakit/tree/main/flutter) | `flutter pub add pakdatakit_flutter` | Flutter input formatters, form fields and a Raast QR widget |
|
|
54
|
+
|
|
55
|
+
The Python and Dart packages are checked against the TypeScript library with over 12,000 shared test cases, so all three give the same results.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 📚 Documentation
|
|
60
|
+
|
|
61
|
+
- **[API reference](https://chmuzamil.github.io/pakdatakit/)**: every function, option and return type
|
|
62
|
+
- **[llms.txt](https://chmuzamil.github.io/pakdatakit/llms.txt)** and **[llms-full.txt](https://chmuzamil.github.io/pakdatakit/llms-full.txt)**: the library in a form AI coding assistants can read
|
|
63
|
+
- **[DATA.md](./DATA.md)**: where every dataset comes from
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
41
67
|
## Why PakDataKit?
|
|
42
68
|
|
|
43
69
|
Every Pakistani application eventually needs to solve the same problems:
|
|
@@ -78,6 +104,7 @@ PakDataKit provides a single, typed, reusable solution so you can focus on build
|
|
|
78
104
|
- ✅ Lakh / Crore Formatting
|
|
79
105
|
- ✅ Amounts in Words (English & Urdu, cheque style)
|
|
80
106
|
- ✅ Zod, Valibot & Yup Form Validation
|
|
107
|
+
- ✅ As-You-Type Formatting for CNIC, Phone & IBAN
|
|
81
108
|
- ✅ NTN & STRN Validation
|
|
82
109
|
- ✅ Landline, UAN (111), Toll-Free (0800) & Premium (0900) Numbers
|
|
83
110
|
- ✅ Raast QR Codes (SBP standard)
|
|
@@ -112,7 +139,7 @@ import { validateCNIC } from 'pakdatakit/cnic';
|
|
|
112
139
|
const { analyzePhone } = require('pakdatakit/phone');
|
|
113
140
|
```
|
|
114
141
|
|
|
115
|
-
Subpaths: `address`, `cnic`, `format`, `geo`, `hijri`, `holidays`, `iban`, `networks`, `numbers`, `phone`, `postal`, `raast`, `tax`, `text`, `whatsapp`, `words`, plus the form adapters `zod`, `valibot` and `yup`.
|
|
142
|
+
Subpaths: `address`, `cnic`, `format`, `geo`, `hijri`, `holidays`, `iban`, `input`, `networks`, `numbers`, `phone`, `postal`, `raast`, `tax`, `text`, `whatsapp`, `words`, plus the form adapters `zod`, `valibot` and `yup`.
|
|
116
143
|
|
|
117
144
|
---
|
|
118
145
|
|
|
@@ -369,7 +396,7 @@ getBankFromIBAN('invalid');
|
|
|
369
396
|
// null
|
|
370
397
|
```
|
|
371
398
|
|
|
372
|
-
Supported bank codes include HABB, MEZN, SCBL, UNIL, BAHL, NBPA, MUCB, JSBL, SADA (SadaPay), and
|
|
399
|
+
Supported bank codes include HABB, MEZN, SCBL, UNIL, BAHL, NBPA, MUCB, JSBL, SADA (SadaPay), NAYA (NayaPay), RQMI (Raqami), MSHQ (Mashreq), and 48 total entries in the dataset, checked against real IBANs (see [DATA.md](./DATA.md)). Merged or renamed banks are labelled with their current name, e.g. `SAUD` → "Silkbank Limited (merged into United Bank Limited)".
|
|
373
400
|
|
|
374
401
|
---
|
|
375
402
|
|
|
@@ -521,7 +548,7 @@ searchCities('kar');
|
|
|
521
548
|
|
|
522
549
|
### getDistrictProvince() / searchDistricts()
|
|
523
550
|
|
|
524
|
-
District-level geography lookup across
|
|
551
|
+
District-level geography lookup across 177 districts, including the 2026 Balochistan and Khyber Pakhtunkhwa changes. Former names such as Quetta and South Waziristan still resolve.
|
|
525
552
|
|
|
526
553
|
```ts
|
|
527
554
|
getDistrictProvince('Lahore'); // "Punjab"
|
|
@@ -700,6 +727,13 @@ const payload = createRaastP2PQr({
|
|
|
700
727
|
expiresAt: new Date(2026, 10, 13, 23, 59),
|
|
701
728
|
});
|
|
702
729
|
|
|
730
|
+
// …or give how long it works: '30m', '12h', '7d' or milliseconds
|
|
731
|
+
createRaastP2PQr({
|
|
732
|
+
iban: 'PK36SCBL0000001123456702',
|
|
733
|
+
amount: 1500,
|
|
734
|
+
expiresIn: '1d',
|
|
735
|
+
});
|
|
736
|
+
|
|
703
737
|
parseRaastQr(payload);
|
|
704
738
|
// { kind: 'p2p', dynamic: true, crcValid: true, iban: 'PK36SCBL0000001123456702',
|
|
705
739
|
// amount: 1500, expiresAt: '2026-11-13T23:59', ... }
|
|
@@ -708,9 +742,7 @@ parseRaastQr(payload);
|
|
|
708
742
|
createMerchantQr({
|
|
709
743
|
merchantAccount: {
|
|
710
744
|
tag: '28',
|
|
711
|
-
fields: {
|
|
712
|
-
/* sub-fields from your bank */
|
|
713
|
-
},
|
|
745
|
+
fields: {/* sub-fields from your bank */},
|
|
714
746
|
},
|
|
715
747
|
merchantName: 'Aziz General Store',
|
|
716
748
|
city: 'Karachi',
|
|
@@ -725,6 +757,25 @@ Person-to-person QR codes use the same layout as QR codes from banking apps (Fay
|
|
|
725
757
|
|
|
726
758
|
SBP reserves merchant-account tags 28–30 for Raast but has shared the layout of the fields inside them only with banks, so `createMerchantQr` takes those sub-fields from you. `parseRaastQr` checks the CRC and finds the IBAN in either kind of QR.
|
|
727
759
|
|
|
760
|
+
### validateRaastQr()
|
|
761
|
+
|
|
762
|
+
Checks a scanned QR before anyone pays, for example to warn about a QR sticker that was replaced or edited.
|
|
763
|
+
|
|
764
|
+
```ts
|
|
765
|
+
validateRaastQr(scannedText);
|
|
766
|
+
// { valid: false, errors: ['expired'], warnings: [], qr: { iban: 'PK36…', amount: 1500, … } }
|
|
767
|
+
```
|
|
768
|
+
|
|
769
|
+
| Errors | Meaning |
|
|
770
|
+
| -------------------------- | ------------------------------------------------------------ |
|
|
771
|
+
| `not-a-raast-qr` | Not a Pakistani payment QR |
|
|
772
|
+
| `bad-checksum` | The QR was damaged or its contents were edited |
|
|
773
|
+
| `no-iban` / `invalid-iban` | No IBAN, or one that fails its checksum |
|
|
774
|
+
| `expired` | A QR with an amount is past its expiry |
|
|
775
|
+
| `missing-expiry` | A QR with an amount has no expiry, so banking apps reject it |
|
|
776
|
+
|
|
777
|
+
Warnings (payment still works): `amount-ignored` when a static QR carries an amount that apps ignore, and `expires-soon` when it expires within an hour (`expiresSoonMs` changes this). Pass `now` to check against another time.
|
|
778
|
+
|
|
728
779
|
---
|
|
729
780
|
|
|
730
781
|
## Public Holidays
|
|
@@ -780,6 +831,38 @@ const CheckoutForm = object({ cnic: pk.cnic().required(), phone: pk.phone() });
|
|
|
780
831
|
|
|
781
832
|
Available schemas: `pk.cnic()`, `pk.phone()`, `pk.iban()`, `pk.ntn()`, `pk.strn()` and `pk.landline()`. Every factory accepts `{ message }` to replace the default error. The Yup schemas let empty values pass so `.required()` decides whether a field is mandatory.
|
|
782
833
|
|
|
834
|
+
### As-you-type helpers
|
|
835
|
+
|
|
836
|
+
Format a field while the user types, and tell a half-typed value apart from a wrong one, so you don't show an error before they've finished.
|
|
837
|
+
|
|
838
|
+
```ts
|
|
839
|
+
import { formatCNICInput, checkCNICInput } from 'pakdatakit/input';
|
|
840
|
+
|
|
841
|
+
formatCNICInput('352021234'); // "35202-1234"
|
|
842
|
+
checkCNICInput('35202-1234'); // "incomplete" — keep typing
|
|
843
|
+
checkCNICInput('05202'); // "invalid" — no CNIC starts with 0
|
|
844
|
+
checkCNICInput('35202-1234567-1'); // "valid"
|
|
845
|
+
```
|
|
846
|
+
|
|
847
|
+
| Field | Formatter | Checker |
|
|
848
|
+
| ------ | -------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
849
|
+
| CNIC | `formatCNICInput` → `35202-1234567-1` | `checkCNICInput` |
|
|
850
|
+
| Mobile | `formatPhoneInput` → `0300-1234567` or `+92 300 1234567` | `checkPhoneInput` (flags an unallocated `03XX` prefix as soon as it's typed) |
|
|
851
|
+
| IBAN | `formatIBANInput` → `PK36 SCBL 0000 0011 2345 6702` | `checkIBANInput` |
|
|
852
|
+
|
|
853
|
+
Checkers return `'empty'`, `'incomplete'`, `'valid'` or `'invalid'`. In React, for example:
|
|
854
|
+
|
|
855
|
+
```tsx
|
|
856
|
+
const [cnic, setCnic] = useState('');
|
|
857
|
+
const state = checkCNICInput(cnic);
|
|
858
|
+
|
|
859
|
+
<input
|
|
860
|
+
value={cnic}
|
|
861
|
+
onChange={(e) => setCnic(formatCNICInput(e.target.value))}
|
|
862
|
+
aria-invalid={state === 'invalid'}
|
|
863
|
+
/>;
|
|
864
|
+
```
|
|
865
|
+
|
|
783
866
|
---
|
|
784
867
|
|
|
785
868
|
# Real-World Example
|
|
@@ -881,10 +964,12 @@ const budget = formatLakh(2500000);
|
|
|
881
964
|
- Raast QR codes
|
|
882
965
|
- Public holidays with observed moon-sighting dates
|
|
883
966
|
|
|
884
|
-
###
|
|
967
|
+
### v2.2 ✅
|
|
885
968
|
|
|
886
|
-
-
|
|
887
|
-
-
|
|
969
|
+
- Python package on PyPI, Dart package on pub.dev
|
|
970
|
+
- `pakdatakit-react` form inputs, `pakdatakit-faker` test data and
|
|
971
|
+
`pakdatakit_flutter` widgets
|
|
972
|
+
- Bank details (`getBankInfo`, `getBanks`), API docs and `llms.txt`
|
|
888
973
|
|
|
889
974
|
---
|
|
890
975
|
|
package/dist/address.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk47P7HILD_cjs = require('./chunk-47P7HILD.cjs');
|
|
4
4
|
require('./chunk-4VVFS6FN.cjs');
|
|
5
|
-
require('./chunk-
|
|
5
|
+
require('./chunk-34CJGJ67.cjs');
|
|
6
6
|
require('./chunk-VPBMIYO2.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "formatAddress", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunk47P7HILD_cjs.formatAddress; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "parseAddress", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunk47P7HILD_cjs.parseAddress; }
|
|
17
17
|
});
|
package/dist/address.d.cts
CHANGED
package/dist/address.d.ts
CHANGED
package/dist/address.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkHTERSQGF_cjs = require('./chunk-HTERSQGF.cjs');
|
|
4
|
+
var chunkNTD4JLDW_cjs = require('./chunk-NTD4JLDW.cjs');
|
|
5
5
|
|
|
6
6
|
// src/phone.ts
|
|
7
7
|
function validatePhone(phone) {
|
|
8
|
-
return
|
|
8
|
+
return chunkNTD4JLDW_cjs.normalizePhoneDigits(phone) !== null;
|
|
9
9
|
}
|
|
10
10
|
function formatPhone(phone) {
|
|
11
|
-
const digits =
|
|
11
|
+
const digits = chunkNTD4JLDW_cjs.normalizePhoneDigits(phone);
|
|
12
12
|
if (digits === null) {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
@@ -26,7 +26,7 @@ function analyzePhone(phone) {
|
|
|
26
26
|
return {
|
|
27
27
|
valid: true,
|
|
28
28
|
formatted,
|
|
29
|
-
network:
|
|
29
|
+
network: chunkHTERSQGF_cjs.getNetwork(phone)
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -916,6 +916,10 @@ var districts_default = [
|
|
|
916
916
|
district: "Abbottabad",
|
|
917
917
|
province: "Khyber Pakhtunkhwa"
|
|
918
918
|
},
|
|
919
|
+
{
|
|
920
|
+
district: "Allai",
|
|
921
|
+
province: "Khyber Pakhtunkhwa"
|
|
922
|
+
},
|
|
919
923
|
{
|
|
920
924
|
district: "Astore",
|
|
921
925
|
province: "Gilgit-Baltistan"
|
|
@@ -952,10 +956,18 @@ var districts_default = [
|
|
|
952
956
|
district: "Bannu",
|
|
953
957
|
province: "Khyber Pakhtunkhwa"
|
|
954
958
|
},
|
|
959
|
+
{
|
|
960
|
+
district: "Bar Swat",
|
|
961
|
+
province: "Khyber Pakhtunkhwa"
|
|
962
|
+
},
|
|
955
963
|
{
|
|
956
964
|
district: "Barkhan",
|
|
957
965
|
province: "Balochistan"
|
|
958
966
|
},
|
|
967
|
+
{
|
|
968
|
+
district: "Barshore",
|
|
969
|
+
province: "Balochistan"
|
|
970
|
+
},
|
|
959
971
|
{
|
|
960
972
|
district: "Batagram",
|
|
961
973
|
province: "Khyber Pakhtunkhwa"
|
|
@@ -972,6 +984,10 @@ var districts_default = [
|
|
|
972
984
|
district: "Buner",
|
|
973
985
|
province: "Khyber Pakhtunkhwa"
|
|
974
986
|
},
|
|
987
|
+
{
|
|
988
|
+
district: "Central Dir",
|
|
989
|
+
province: "Khyber Pakhtunkhwa"
|
|
990
|
+
},
|
|
975
991
|
{
|
|
976
992
|
district: "Chagai",
|
|
977
993
|
province: "Balochistan"
|
|
@@ -1000,10 +1016,6 @@ var districts_default = [
|
|
|
1000
1016
|
district: "Darel",
|
|
1001
1017
|
province: "Gilgit-Baltistan"
|
|
1002
1018
|
},
|
|
1003
|
-
{
|
|
1004
|
-
district: "Dera Bugti",
|
|
1005
|
-
province: "Balochistan"
|
|
1006
|
-
},
|
|
1007
1019
|
{
|
|
1008
1020
|
district: "Dera Ghazi Khan",
|
|
1009
1021
|
province: "Punjab"
|
|
@@ -1360,6 +1372,10 @@ var districts_default = [
|
|
|
1360
1372
|
district: "Neelam",
|
|
1361
1373
|
province: "Azad Jammu and Kashmir"
|
|
1362
1374
|
},
|
|
1375
|
+
{
|
|
1376
|
+
district: "North Dera Bugti",
|
|
1377
|
+
province: "Balochistan"
|
|
1378
|
+
},
|
|
1363
1379
|
{
|
|
1364
1380
|
district: "North Waziristan",
|
|
1365
1381
|
province: "Khyber Pakhtunkhwa"
|
|
@@ -1380,6 +1396,10 @@ var districts_default = [
|
|
|
1380
1396
|
district: "Orakzai",
|
|
1381
1397
|
province: "Khyber Pakhtunkhwa"
|
|
1382
1398
|
},
|
|
1399
|
+
{
|
|
1400
|
+
district: "Paharpur",
|
|
1401
|
+
province: "Khyber Pakhtunkhwa"
|
|
1402
|
+
},
|
|
1383
1403
|
{
|
|
1384
1404
|
district: "Pakpattan",
|
|
1385
1405
|
province: "Punjab"
|
|
@@ -1405,7 +1425,11 @@ var districts_default = [
|
|
|
1405
1425
|
province: "Sindh"
|
|
1406
1426
|
},
|
|
1407
1427
|
{
|
|
1408
|
-
district: "Quetta",
|
|
1428
|
+
district: "Quetta East",
|
|
1429
|
+
province: "Balochistan"
|
|
1430
|
+
},
|
|
1431
|
+
{
|
|
1432
|
+
district: "Quetta West",
|
|
1409
1433
|
province: "Balochistan"
|
|
1410
1434
|
},
|
|
1411
1435
|
{
|
|
@@ -1476,6 +1500,10 @@ var districts_default = [
|
|
|
1476
1500
|
district: "Sohbatpur",
|
|
1477
1501
|
province: "Balochistan"
|
|
1478
1502
|
},
|
|
1503
|
+
{
|
|
1504
|
+
district: "South Dera Bugti",
|
|
1505
|
+
province: "Balochistan"
|
|
1506
|
+
},
|
|
1479
1507
|
{
|
|
1480
1508
|
district: "Sudhnuti",
|
|
1481
1509
|
province: "Azad Jammu and Kashmir"
|
|
@@ -1540,6 +1568,10 @@ var districts_default = [
|
|
|
1540
1568
|
district: "Tor Ghar",
|
|
1541
1569
|
province: "Khyber Pakhtunkhwa"
|
|
1542
1570
|
},
|
|
1571
|
+
{
|
|
1572
|
+
district: "Tump",
|
|
1573
|
+
province: "Balochistan"
|
|
1574
|
+
},
|
|
1543
1575
|
{
|
|
1544
1576
|
district: "Umerkot",
|
|
1545
1577
|
province: "Sindh"
|
|
@@ -1568,6 +1600,10 @@ var districts_default = [
|
|
|
1568
1600
|
district: "Vehari",
|
|
1569
1601
|
province: "Punjab"
|
|
1570
1602
|
},
|
|
1603
|
+
{
|
|
1604
|
+
district: "Wadh",
|
|
1605
|
+
province: "Balochistan"
|
|
1606
|
+
},
|
|
1571
1607
|
{
|
|
1572
1608
|
district: "Washuk",
|
|
1573
1609
|
province: "Balochistan"
|
|
@@ -1621,8 +1657,19 @@ function getDistrictProvince(district) {
|
|
|
1621
1657
|
if (key.length === 0) {
|
|
1622
1658
|
return null;
|
|
1623
1659
|
}
|
|
1624
|
-
return districtLookup().get(key) ?? null;
|
|
1660
|
+
return districtLookup().get(key) ?? (Object.hasOwn(FORMER_DISTRICTS, key) ? FORMER_DISTRICTS[key] : null) ?? null;
|
|
1625
1661
|
}
|
|
1662
|
+
var FORMER_DISTRICTS = {
|
|
1663
|
+
// Split into Lower and Upper South Waziristan (2022).
|
|
1664
|
+
"south waziristan": "Khyber Pakhtunkhwa",
|
|
1665
|
+
// Split into Quetta East and Quetta West (2026).
|
|
1666
|
+
quetta: "Balochistan",
|
|
1667
|
+
// Became South Dera Bugti; Upper Dera Bugti became North Dera Bugti (2026).
|
|
1668
|
+
"dera bugti": "Balochistan",
|
|
1669
|
+
"upper dera bugti": "Balochistan",
|
|
1670
|
+
// Notified as Bar Swat (2026); reported as Upper Swat before that.
|
|
1671
|
+
"upper swat": "Khyber Pakhtunkhwa"
|
|
1672
|
+
};
|
|
1626
1673
|
function searchDistricts(query) {
|
|
1627
1674
|
const normalizedQuery = chunkVPBMIYO2_cjs.normalizeKey(query);
|
|
1628
1675
|
if (normalizedQuery.length === 0) {
|