pakdatakit 2.0.0
TypeScript (npm)
Section titled “TypeScript (npm)”A bug-fix release. Several fixes change return values, so this is a major version.
Breaking changes
Section titled “Breaking changes”- Node.js 20+ is required (Node 18 is end-of-life).
formatPhone()andcreateWhatsAppLink()returnnullinstead of""for invalid numbers.getHijriMonthName()returnsnullinstead of""for invalid months.toHijri(),formatHijri()andisRamadan()throw aRangeErrorfor invalid dates instead of returningNaNfields.fromHijri()throws for out-of-range Hijri components.formatPKR()andformatLakh()throw aRangeErrorforNaNandInfinity, and keep the sign of negative amounts (they previously returned"Rs. 0"for all of these).validatePhone()rejects numbers on03XXprefixes that are not allocated to a mobile operator (e.g.036x,038x,039x).validateCNIC()rejects a leading0or9, misplaced separators and mixed separators.NetworkNameadds'SCO'.ParsedAddressadds awarnings: string[]field.formatAddress()no longer adds a GPO postal code that was not supplied.normalizeRomanUrdu()keeps capitalisation (Assalam o Alaikum→Assalamualaikum) and no longer rewritesmein/men.- Dataset changes:
South Waziristanis nowLower South WaziristanandUpper South Waziristan; neighbourhoods such asGulbergandSaddarare no longer returned as cities; bank codesSILK,BIPLandBARCare removed.
- Hijri dates were one day behind the tabular calendar for every date, and
fromHijri(toHijri(d))returned the previous day. Conversions now matchislamic-civilexactly and round-trip. Added anoffsetoption for moon-sighting adjustment. - Cities: the list was cut at 150 entries, so
getProvince()returnednullfor Bahawalpur, Sargodha, Larkana, Mardan, Abbottabad and 72 other cities with postal codes. All 226 cities are now included. - Districts: 7 Gilgit-Baltistan districts were listed twice. Added Taunsa, Hub and Usta Muhammad, and split South Waziristan (168 districts).
- Banks:
SAUDis Silkbank’s IBAN code (merged into UBL), not Saudi Pak; Summit Bank (now Bank Makramah) usesSUMB; renamed microfinance banks (easypaisa, HBL Microfinance, ABHI) now show current names. Removed an alias table that never took effect. - Phone: added
0329(Jazz) and0355(SCO); accepts+92 (0) 3…,+9203…, dotted numbers and Urdu digits. - CNIC: accepts en-dashes, dots and Urdu digits.
- formatLakh rounds before choosing the unit:
9,999,999is"1 Crore", not"100 Lakh". - parseAddress ignores house, plot, street and PO box numbers when finding the postal code, works without commas, and reports city/province conflicts.
- normalizeRomanUrdu: removed 6 rules that did nothing and the rules that
changed
mein(“in”) tomain(“I”); acronyms such asAPare left alone. - CLI exits with 1 for invalid/not found and 2 for usage errors, rejects
non-numeric amounts and invalid dates, and supports
--version.
- CommonJS build alongside ESM.
- Subpath imports (
pakdatakit/cnic,pakdatakit/phone, …). Importing a single function no longer pulls in every dataset:validateCNICalone bundles to about 0.4 KB instead of 25 KB. - Dataset integrity tests and CI on Node 20, 22 and 24 with a format check.