Skip to content

pakdatakit 2.5.0

Choose a tag to compare

@github-actions github-actions released this 18 Nov 10:49
· 28 commits to main since this release
573fdb7

pakdatakit 2.5.0 · Package · Docs · Playground

Includes everything prepared for 2.4.0, which was never published on its own: the 2.4.0 changes are listed here with the 2.5.0 ones.

Added

  • slugify(), compareUrdu(), isRTL() and wrapBidi() (pakdatakit/text).
    slugify makes URL slugs that keep Urdu letters (no transliteration), with
    script: 'any' | 'latin' | 'urdu'. compareUrdu sorts in Urdu alphabetical
    order following the Unicode CLDR collation for Urdu (CLDR 49), with letters
    joined to ھ as letters of their own, the same in every port without ICU.
    isRTL checks the first letter's direction; wrapBidi wraps text in
    Unicode directional isolates.
  • calculateSalaryTax(), calculateMonthlySalaryTax(), getSalaryTaxSlabs(),
    getSalaryTaxYears() and getTaxYear() (pakdatakit/incometax), with the
    new dataset data/income-tax-slabs.json: the salaried income tax rate table
    for tax years 2020 to 2027 from FBR's consolidated Income Tax Ordinance.
    Returns the tax, the monthly amount, the effective rate and the slab, rounded
    half up to the paisa. Surcharge, credits and exemptions are not applied.
    The source for tax year 2027 is the Finance Act, 2026 as gazetted; FBR
    Circular No. 02 of 2026-27 and the consolidated Ordinance are cited in
    DATA.md.
  • scoreAddress() and phoneRiskSignals() (pakdatakit/quality): heuristics
    for cash on delivery. scoreAddress scores an address 0 to 100 from its city,
    house number, street, area, postal code (a known post office scores more)
    and landmark words in English, Roman Urdu and Urdu, and lists what is
    missing. phoneRiskSignals flags invalid, landline, service, repeated-digit,
    sequential and placeholder numbers. The form adapters gain pk.codPhone()
    (IsCodPhone for class-validator).
  • getSalesTaxRate(), calculateSalesTax() and splitInclusive()
    (pakdatakit/salestax): standard sales tax rates with the dates they
    applied, from 1 July 2019, for goods (federal) and for services in Punjab,
    Sindh, Khyber Pakhtunkhwa, Balochistan and Islamabad Capital Territory, each
    with its law and official source (new dataset sales-tax-rates.json).
    Amounts are rounded half up to the paisa.
  • parseElectricityRef(), validateElectricityRef() and
    validateGasConsumerNumber() (pakdatakit/bills): DISCO 14-digit reference
    numbers (with U/R), DISCO customer IDs, K-Electric account numbers, and SNGPL
    and SSGC consumer numbers, in the formats the utilities' bill pages ask for.
    disco is null for DISCO bills, as no official source maps the digits to a
    company.
  • mapCourierStatus() and normalizeCityForCourier() (pakdatakit/courier):
    one status vocabulary for courier statuses, mapping only publicly documented
    statuses (PostEx's API guide v4.1.9 and Leopards' "Returned to Shipper"; TCS,
    M&P, Trax and BlueEx publish none), and city short forms (LHR, Khi,
    Pindi, Isb, Lyallpur, Urdu names) mapped to the city list. No API clients
    and no tracking-number detection, as no courier documents its format. The
    status mapping is experimental: its values may change in a minor release
    as more couriers' lists are added (see CONTRIBUTING.md).
  • buildFbrInvoice() and validateFbrInvoice() (pakdatakit/fbr-invoice):
    types for FBR's Digital Invoicing JSON, a builder that works out each line's
    sales tax, and an offline validator that reports FBR's error codes, following
    PRAL's "Technical Specification for DI API" v1.12. No HTTP client and no
    tokens.

Changed

  • Package metadata: the description, keywords and homepage now follow the same
    style in every registry, and CI checks that the version, repository URL,
    licence and author agree across ports (npm run check:metadata).
  • bin and repository.url in package.json are written in the form npm
    publishes, so npm publish no longer warns that it corrected them.
  • New NOTICE file (included in the npm package) and an "Origin and
    attribution" section in the README.
  • test-vectors/README.md documents the shared test vectors;
    npm run test:ports regenerates them and runs every port against them.
  • dataVersion is now 2026-11-18 (new dataset: sales tax rates).