pakdatakit 2.6.0 → 2.7.0
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 +83 -7
- package/README.md +48 -14
- package/dist/{chunk-LQHM3ADX.js → chunk-33JPVN33.js} +11 -6
- package/dist/{chunk-YSRYWZCQ.cjs → chunk-36K225SE.cjs} +9 -9
- package/dist/{chunk-CEPNSHIC.js → chunk-3OCMTNQ7.js} +1 -1
- package/dist/{chunk-YDUXIENX.cjs → chunk-4YLSPXBZ.cjs} +2 -2
- package/dist/{chunk-2OBKPYJZ.cjs → chunk-6AIN4FKB.cjs} +12 -4
- package/dist/chunk-7NTUEHQV.cjs +69 -0
- package/dist/{chunk-KRYHLYN2.js → chunk-BATPA7GN.js} +12 -4
- package/dist/chunk-CKCOK6X4.js +64 -0
- package/dist/{chunk-7DY26QPN.js → chunk-CRYCAMWC.js} +1 -1
- package/dist/{chunk-TVL6RDAU.cjs → chunk-EGF4CINK.cjs} +2 -2
- package/dist/{chunk-XVEG53NN.cjs → chunk-GOGEMCGG.cjs} +84 -0
- package/dist/{chunk-QG5T7YQ5.js → chunk-OYQJQE5R.js} +5 -5
- package/dist/{chunk-5RGX4DWF.js → chunk-SGGQ6XB2.js} +46 -14
- package/dist/{chunk-UYFTXD4P.js → chunk-T6K46DGW.js} +1 -1
- package/dist/{chunk-AUQFA7EE.cjs → chunk-VSIVT5RT.cjs} +11 -6
- package/dist/{chunk-H6M6L26S.cjs → chunk-VZIBHQC7.cjs} +2 -2
- package/dist/{chunk-EA3SIHYT.js → chunk-WYNM5ZWY.js} +84 -1
- package/dist/{chunk-5DDHO5Z7.cjs → chunk-XWGSREI5.cjs} +46 -14
- package/dist/class-validator.cjs +13 -8
- package/dist/class-validator.d.cts +5 -2
- package/dist/class-validator.d.ts +5 -2
- package/dist/class-validator.js +12 -7
- package/dist/cli.js +1 -1
- package/dist/cnic.cjs +11 -3
- package/dist/cnic.d.cts +80 -3
- package/dist/cnic.d.ts +80 -3
- package/dist/cnic.js +1 -1
- package/dist/incometax.cjs +6 -6
- package/dist/incometax.d.cts +51 -7
- package/dist/incometax.d.ts +51 -7
- package/dist/incometax.js +1 -1
- package/dist/index.cjs +56 -44
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +9 -9
- package/dist/input.cjs +8 -8
- package/dist/input.js +2 -2
- package/dist/joi.cjs +7 -7
- package/dist/joi.d.cts +1 -1
- package/dist/joi.d.ts +1 -1
- package/dist/joi.js +6 -6
- package/dist/numbers.cjs +5 -5
- package/dist/numbers.d.cts +28 -5
- package/dist/numbers.d.ts +28 -5
- package/dist/numbers.js +1 -1
- package/dist/quality.cjs +5 -5
- package/dist/quality.js +2 -2
- package/dist/raast.cjs +5 -5
- package/dist/raast.d.cts +17 -6
- package/dist/raast.d.ts +17 -6
- package/dist/raast.js +1 -1
- package/dist/{rules-GxgPiVws.d.cts → rules-GEELAOfb.d.cts} +5 -0
- package/dist/{rules-GxgPiVws.d.ts → rules-GEELAOfb.d.ts} +5 -0
- package/dist/superstruct.cjs +7 -7
- package/dist/superstruct.d.cts +1 -1
- package/dist/superstruct.d.ts +1 -1
- package/dist/superstruct.js +6 -6
- package/dist/tax.cjs +5 -5
- package/dist/tax.d.cts +8 -2
- package/dist/tax.d.ts +8 -2
- package/dist/tax.js +2 -2
- package/dist/text.cjs +13 -9
- package/dist/text.d.cts +40 -4
- package/dist/text.d.ts +40 -4
- package/dist/text.js +1 -1
- package/dist/valibot.cjs +13 -7
- package/dist/valibot.d.cts +1 -1
- package/dist/valibot.d.ts +1 -1
- package/dist/valibot.js +12 -6
- package/dist/words.d.cts +4 -1
- package/dist/words.d.ts +4 -1
- package/dist/yup.cjs +7 -7
- package/dist/yup.d.cts +1 -1
- package/dist/yup.d.ts +1 -1
- package/dist/yup.js +6 -6
- package/dist/zod.cjs +9 -7
- package/dist/zod.d.cts +1 -1
- package/dist/zod.d.ts +1 -1
- package/dist/zod.js +8 -6
- package/package.json +1 -1
- package/dist/chunk-EEVNLTB4.js +0 -32
- package/dist/chunk-HTCSHHOR.cjs +0 -35
|
@@ -311,11 +311,95 @@ function wrapBidi(text, direction = "auto") {
|
|
|
311
311
|
const open = direction === "rtl" ? "\u2067" : direction === "ltr" ? "\u2066" : "\u2068";
|
|
312
312
|
return `${open}${text}\u2069`;
|
|
313
313
|
}
|
|
314
|
+
var KEY_DIGRAPHS = {
|
|
315
|
+
kh: "kh",
|
|
316
|
+
gh: "g",
|
|
317
|
+
sh: "sh",
|
|
318
|
+
ch: "ch",
|
|
319
|
+
ph: "f",
|
|
320
|
+
th: "t",
|
|
321
|
+
dh: "d",
|
|
322
|
+
bh: "b",
|
|
323
|
+
jh: "j",
|
|
324
|
+
zh: "z",
|
|
325
|
+
ck: "k"
|
|
326
|
+
};
|
|
327
|
+
var KEY_LETTERS = {
|
|
328
|
+
c: "k",
|
|
329
|
+
q: "k",
|
|
330
|
+
v: "w",
|
|
331
|
+
x: "ks"
|
|
332
|
+
};
|
|
333
|
+
var PLAIN_VOWELS = "aeiou";
|
|
334
|
+
function vowelClass(letter) {
|
|
335
|
+
if (letter === "a" || letter === "e") return "a";
|
|
336
|
+
if (letter === "i" || letter === "y") return "i";
|
|
337
|
+
return "u";
|
|
338
|
+
}
|
|
339
|
+
function firstVowelClass(run, wordStart) {
|
|
340
|
+
if (run.startsWith("ee")) return "i";
|
|
341
|
+
if (wordStart && run.startsWith("e")) return "i";
|
|
342
|
+
if (/^[ao][uw]/.test(run)) return "u";
|
|
343
|
+
if (/^(a[iye]|e[iy])/.test(run)) return "e";
|
|
344
|
+
return vowelClass(run[0]);
|
|
345
|
+
}
|
|
346
|
+
function wordKey(word) {
|
|
347
|
+
let letters = "";
|
|
348
|
+
for (let i = 0; i < word.length; ) {
|
|
349
|
+
const pair = KEY_DIGRAPHS[word.slice(i, i + 2)];
|
|
350
|
+
if (pair !== void 0) {
|
|
351
|
+
letters += pair;
|
|
352
|
+
i += 2;
|
|
353
|
+
} else {
|
|
354
|
+
const letter = word[i];
|
|
355
|
+
letters += KEY_LETTERS[letter] ?? letter;
|
|
356
|
+
i += 1;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
letters = letters.replace(/([^e])\1+/g, "$1");
|
|
360
|
+
const vowel = [];
|
|
361
|
+
for (let i = 0; i < letters.length; i += 1) {
|
|
362
|
+
const letter = letters[i];
|
|
363
|
+
vowel.push(
|
|
364
|
+
PLAIN_VOWELS.includes(letter) || letter === "y" && i > 0 || letter === "w" && i > 0 && vowel[i - 1] === true && !PLAIN_VOWELS.includes(letters[i + 1] ?? "")
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
const last = letters.length - 1;
|
|
368
|
+
if (last > 0 && letters[last] === "h" && vowel[last - 1] === true) {
|
|
369
|
+
letters = letters.slice(0, last);
|
|
370
|
+
vowel.pop();
|
|
371
|
+
}
|
|
372
|
+
let key = "";
|
|
373
|
+
let firstVowelDone = false;
|
|
374
|
+
for (let i = 0; i < letters.length; ) {
|
|
375
|
+
if (!vowel[i]) {
|
|
376
|
+
key += letters[i];
|
|
377
|
+
i += 1;
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
let end = i;
|
|
381
|
+
while (end < letters.length && vowel[end]) end += 1;
|
|
382
|
+
const run = letters.slice(i, end);
|
|
383
|
+
if (!firstVowelDone) {
|
|
384
|
+
key += firstVowelClass(run, i === 0);
|
|
385
|
+
firstVowelDone = true;
|
|
386
|
+
} else if (end === letters.length) {
|
|
387
|
+
key += run.endsWith("ee") ? "i" : vowelClass(run[run.length - 1]);
|
|
388
|
+
}
|
|
389
|
+
i = end;
|
|
390
|
+
}
|
|
391
|
+
return key;
|
|
392
|
+
}
|
|
393
|
+
function romanUrduKey(text) {
|
|
394
|
+
if (typeof text !== "string") return "";
|
|
395
|
+
return text.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g, "").split(/[^a-z]+/).filter((word) => word !== "").map(wordKey).join(" ");
|
|
396
|
+
}
|
|
314
397
|
|
|
315
398
|
exports.compareUrdu = compareUrdu;
|
|
316
399
|
exports.isRTL = isRTL;
|
|
317
400
|
exports.normalizeRomanUrdu = normalizeRomanUrdu;
|
|
318
401
|
exports.normalizeText = normalizeText;
|
|
402
|
+
exports.romanUrduKey = romanUrduKey;
|
|
319
403
|
exports.slugify = slugify;
|
|
320
404
|
exports.toEnglishDigits = toEnglishDigits;
|
|
321
405
|
exports.toUrduDigits = toUrduDigits;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { validatePhone } from './chunk-S274QFFB.js';
|
|
2
|
-
import { phoneRiskSignals } from './chunk-
|
|
3
|
-
import { validateSTRN, validateNTN } from './chunk-
|
|
2
|
+
import { phoneRiskSignals } from './chunk-T6K46DGW.js';
|
|
3
|
+
import { validateSTRN, validateNTN } from './chunk-3OCMTNQ7.js';
|
|
4
4
|
import { validateVehiclePlate } from './chunk-RZQJAZKC.js';
|
|
5
5
|
import { validateIBAN } from './chunk-IBZPJS4H.js';
|
|
6
|
-
import { validateLandline } from './chunk-
|
|
6
|
+
import { validateLandline } from './chunk-33JPVN33.js';
|
|
7
7
|
import { validatePassport } from './chunk-E6HSKRAE.js';
|
|
8
|
-
import { validateCNIC } from './chunk-
|
|
8
|
+
import { validateCNIC } from './chunk-CKCOK6X4.js';
|
|
9
9
|
import { parseAmount } from './chunk-NDW52ZK3.js';
|
|
10
10
|
|
|
11
11
|
// src/adapters/rules.ts
|
|
@@ -16,7 +16,7 @@ var RULES = {
|
|
|
16
16
|
ntn: { test: validateNTN, message: "Invalid NTN" },
|
|
17
17
|
strn: { test: validateSTRN, message: "Invalid STRN" },
|
|
18
18
|
landline: {
|
|
19
|
-
test: validateLandline,
|
|
19
|
+
test: (value, options) => validateLandline(value, { services: options.services === true }),
|
|
20
20
|
message: "Invalid Pakistani landline number"
|
|
21
21
|
},
|
|
22
22
|
passport: {
|
|
@@ -81,7 +81,8 @@ var income_tax_slabs_default = [
|
|
|
81
81
|
fixed: 2142e4,
|
|
82
82
|
rate: 35
|
|
83
83
|
}
|
|
84
|
-
]
|
|
84
|
+
],
|
|
85
|
+
surcharge: null
|
|
85
86
|
},
|
|
86
87
|
{
|
|
87
88
|
taxYear: 2021,
|
|
@@ -162,7 +163,8 @@ var income_tax_slabs_default = [
|
|
|
162
163
|
fixed: 2142e4,
|
|
163
164
|
rate: 35
|
|
164
165
|
}
|
|
165
|
-
]
|
|
166
|
+
],
|
|
167
|
+
surcharge: null
|
|
166
168
|
},
|
|
167
169
|
{
|
|
168
170
|
taxYear: 2022,
|
|
@@ -243,7 +245,8 @@ var income_tax_slabs_default = [
|
|
|
243
245
|
fixed: 2142e4,
|
|
244
246
|
rate: 35
|
|
245
247
|
}
|
|
246
|
-
]
|
|
248
|
+
],
|
|
249
|
+
surcharge: null
|
|
247
250
|
},
|
|
248
251
|
{
|
|
249
252
|
taxYear: 2023,
|
|
@@ -294,7 +297,8 @@ var income_tax_slabs_default = [
|
|
|
294
297
|
fixed: 2955e3,
|
|
295
298
|
rate: 35
|
|
296
299
|
}
|
|
297
|
-
]
|
|
300
|
+
],
|
|
301
|
+
surcharge: null
|
|
298
302
|
},
|
|
299
303
|
{
|
|
300
304
|
taxYear: 2024,
|
|
@@ -339,7 +343,8 @@ var income_tax_slabs_default = [
|
|
|
339
343
|
fixed: 1095e3,
|
|
340
344
|
rate: 35
|
|
341
345
|
}
|
|
342
|
-
]
|
|
346
|
+
],
|
|
347
|
+
surcharge: null
|
|
343
348
|
},
|
|
344
349
|
{
|
|
345
350
|
taxYear: 2025,
|
|
@@ -384,7 +389,13 @@ var income_tax_slabs_default = [
|
|
|
384
389
|
fixed: 7e5,
|
|
385
390
|
rate: 35
|
|
386
391
|
}
|
|
387
|
-
]
|
|
392
|
+
],
|
|
393
|
+
surcharge: {
|
|
394
|
+
rate: 10,
|
|
395
|
+
over: 1e7,
|
|
396
|
+
law: "Income Tax Ordinance 2001, s. 4AB, inserted by the Finance Act 2024, s. 8(2): 10% of the tax under Division I where taxable income exceeds Rs 10 million",
|
|
397
|
+
source: "https://download1.fbr.gov.pk/Docs/2024630146346801FinanceAct-2024.pdf"
|
|
398
|
+
}
|
|
388
399
|
},
|
|
389
400
|
{
|
|
390
401
|
taxYear: 2026,
|
|
@@ -429,7 +440,13 @@ var income_tax_slabs_default = [
|
|
|
429
440
|
fixed: 616e3,
|
|
430
441
|
rate: 35
|
|
431
442
|
}
|
|
432
|
-
]
|
|
443
|
+
],
|
|
444
|
+
surcharge: {
|
|
445
|
+
rate: 9,
|
|
446
|
+
over: 1e7,
|
|
447
|
+
law: "Income Tax Ordinance 2001, s. 4AB, proviso added by the Finance Act 2025: 9% for an individual with income under the head Salary, where taxable income exceeds Rs 10 million",
|
|
448
|
+
source: "https://download1.fbr.gov.pk/Docs/2025881983148210Income-Tax-Ordinance,-2001-Amended-upto-31.07.2025.pdf"
|
|
449
|
+
}
|
|
433
450
|
},
|
|
434
451
|
{
|
|
435
452
|
taxYear: 2027,
|
|
@@ -486,7 +503,13 @@ var income_tax_slabs_default = [
|
|
|
486
503
|
fixed: 1424e3,
|
|
487
504
|
rate: 35
|
|
488
505
|
}
|
|
489
|
-
]
|
|
506
|
+
],
|
|
507
|
+
surcharge: {
|
|
508
|
+
rate: 0,
|
|
509
|
+
over: 1e7,
|
|
510
|
+
law: "Income Tax Ordinance 2001, s. 4AB, proviso substituted by the Finance Act 2026, s. 5(2)(b): no surcharge for an individual with income under the head Salary",
|
|
511
|
+
source: "https://download1.fbr.gov.pk/Docs/20266291261044366FinanceAct2026.pdf"
|
|
512
|
+
}
|
|
490
513
|
}
|
|
491
514
|
];
|
|
492
515
|
|
|
@@ -517,7 +540,8 @@ function findYear(options) {
|
|
|
517
540
|
}
|
|
518
541
|
var copyYear = (year) => ({
|
|
519
542
|
...year,
|
|
520
|
-
slabs: year.slabs.map((slab) => ({ ...slab }))
|
|
543
|
+
slabs: year.slabs.map((slab) => ({ ...slab })),
|
|
544
|
+
surcharge: year.surcharge === null ? null : { ...year.surcharge }
|
|
521
545
|
});
|
|
522
546
|
function getSalaryTaxSlabs(taxYear) {
|
|
523
547
|
const year = findYear(taxYear === void 0 ? void 0 : { taxYear });
|
|
@@ -526,7 +550,7 @@ function getSalaryTaxSlabs(taxYear) {
|
|
|
526
550
|
function getSalaryTaxYears() {
|
|
527
551
|
return YEARS.map((y) => y.taxYear);
|
|
528
552
|
}
|
|
529
|
-
function compute(incomePaisa, year) {
|
|
553
|
+
function compute(incomePaisa, year, includeSurcharge) {
|
|
530
554
|
const slabs = year.slabs;
|
|
531
555
|
let slab = slabs[0];
|
|
532
556
|
for (const candidate of slabs) {
|
|
@@ -535,10 +559,18 @@ function compute(incomePaisa, year) {
|
|
|
535
559
|
const rateBp = Math.round(slab.rate * 100);
|
|
536
560
|
const above = BigInt(incomePaisa - slab.over * 100);
|
|
537
561
|
const taxPaisa = incomePaisa > slab.over * 100 ? slab.fixed * 100 + divideHalfUp(above * BigInt(rateBp), 10000n) : slab.fixed * 100;
|
|
562
|
+
const surcharge = year.surcharge;
|
|
563
|
+
const surchargePaisa = includeSurcharge && surcharge !== null && surcharge.rate > 0 && incomePaisa > surcharge.over * 100 ? divideHalfUp(
|
|
564
|
+
BigInt(taxPaisa) * BigInt(Math.round(surcharge.rate * 100)),
|
|
565
|
+
10000n
|
|
566
|
+
) : 0;
|
|
567
|
+
const totalPaisa = taxPaisa + surchargePaisa;
|
|
538
568
|
return {
|
|
539
569
|
tax: fromPaisa(taxPaisa),
|
|
540
|
-
|
|
541
|
-
|
|
570
|
+
surcharge: fromPaisa(surchargePaisa),
|
|
571
|
+
total: fromPaisa(totalPaisa),
|
|
572
|
+
monthly: fromPaisa(divideHalfUp(BigInt(totalPaisa), 12n)),
|
|
573
|
+
effectiveRate: incomePaisa === 0 ? 0 : divideHalfUp(BigInt(totalPaisa) * 10000n, BigInt(incomePaisa)) / 100,
|
|
542
574
|
slab: { ...slab },
|
|
543
575
|
taxYear: year.taxYear
|
|
544
576
|
};
|
|
@@ -547,13 +579,13 @@ function calculateSalaryTax(annualIncome, options) {
|
|
|
547
579
|
const paisa = toUnits(annualIncome, 2);
|
|
548
580
|
if (paisa === null) return null;
|
|
549
581
|
const year = findYear(options);
|
|
550
|
-
return year ? compute(paisa, year) : null;
|
|
582
|
+
return year ? compute(paisa, year, options?.includeSurcharge === true) : null;
|
|
551
583
|
}
|
|
552
584
|
function calculateMonthlySalaryTax(monthlySalary, options) {
|
|
553
585
|
const paisa = toUnits(monthlySalary, 2);
|
|
554
586
|
if (paisa === null) return null;
|
|
555
587
|
const year = findYear(options);
|
|
556
|
-
return year ? compute(paisa * 12, year) : null;
|
|
588
|
+
return year ? compute(paisa * 12, year, options?.includeSurcharge === true) : null;
|
|
557
589
|
}
|
|
558
590
|
|
|
559
591
|
export { calculateMonthlySalaryTax, calculateSalaryTax, getSalaryTaxSlabs, getSalaryTaxYears, getTaxYear };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { analyzeNumber } from './chunk-
|
|
1
|
+
import { analyzeNumber } from './chunk-33JPVN33.js';
|
|
2
2
|
import { parseAddress } from './chunk-B7DOQ5QF.js';
|
|
3
3
|
import { getPostOffice } from './chunk-33QMFE2Z.js';
|
|
4
4
|
import { normalizeWhitespace, toAsciiDigits } from './chunk-ENQ7O7VW.js';
|
|
@@ -471,9 +471,8 @@ var area_codes_default = [
|
|
|
471
471
|
var FIXED_LINE = /^(?:(?:(?:21|42)[2-9]|58[126])\d{7}|(?:2[25]|4[0146-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]\d{6,7}|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8]))[2-9]\d{5,6})$/;
|
|
472
472
|
var UAN = /^((?:2(?:[125]|3[2358]|4[2-4]|9[2-8])|4(?:[0-246-9]|5[3479])|5(?:[1-35-7]|4[2-467])|6(?:0[468]|[1-8])|7(?:[14]|2[236])|8(?:[16]|2[2-689]|3[23578]|4[3478]|5[2356])|9(?:1|22|3[27-9]|4[2-6]|6[3569]|9[2-7])))111(\d{6})$/;
|
|
473
473
|
var UAN_WITHOUT_AREA_CODE = /^111(\d{6})$/;
|
|
474
|
-
var TOLL_FREE = /^800(\d{5}
|
|
474
|
+
var TOLL_FREE = /^800(\d{5})$/;
|
|
475
475
|
var PREMIUM = /^900(\d{5})$/;
|
|
476
|
-
var PERSONAL = /^122(\d{6})$/;
|
|
477
476
|
var areaCodes = /* @__PURE__ */ chunkVPBMIYO2_cjs.lazy(() => area_codes_default);
|
|
478
477
|
var areaCodeMap = /* @__PURE__ */ chunkVPBMIYO2_cjs.lazy(
|
|
479
478
|
() => new Map(areaCodes().map((entry) => [entry.code, entry.cities]))
|
|
@@ -545,8 +544,6 @@ function analyzeNumber(phone) {
|
|
|
545
544
|
if (tollFree) return service("toll-free", "800", tollFree[1]);
|
|
546
545
|
const premium = PREMIUM.exec(national);
|
|
547
546
|
if (premium) return service("premium", "900", premium[1]);
|
|
548
|
-
const personal = PERSONAL.exec(national);
|
|
549
|
-
if (personal) return service("personal", "122", personal[1]);
|
|
550
547
|
const uan = UAN.exec(national);
|
|
551
548
|
if (uan) {
|
|
552
549
|
const code = uan[1];
|
|
@@ -573,8 +570,16 @@ function analyzeNumber(phone) {
|
|
|
573
570
|
function getNumberType(phone) {
|
|
574
571
|
return analyzeNumber(phone)?.type ?? null;
|
|
575
572
|
}
|
|
576
|
-
|
|
577
|
-
|
|
573
|
+
var SERVICE_TYPES = /* @__PURE__ */ new Set([
|
|
574
|
+
"uan",
|
|
575
|
+
"toll-free",
|
|
576
|
+
"premium"
|
|
577
|
+
]);
|
|
578
|
+
function validateLandline(phone, options = {}) {
|
|
579
|
+
if (typeof phone !== "string") return false;
|
|
580
|
+
const type = getNumberType(phone);
|
|
581
|
+
if (type === "landline") return true;
|
|
582
|
+
return options.services === true && type !== null && SERVICE_TYPES.has(type);
|
|
578
583
|
}
|
|
579
584
|
function getAreaCode(city) {
|
|
580
585
|
const key = chunkVPBMIYO2_cjs.normalizeKey(city);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk7NTUEHQV_cjs = require('./chunk-7NTUEHQV.cjs');
|
|
4
4
|
var chunkVPBMIYO2_cjs = require('./chunk-VPBMIYO2.cjs');
|
|
5
5
|
|
|
6
6
|
// src/tax.ts
|
|
7
7
|
function analyzeNTN(ntn) {
|
|
8
8
|
const trimmed = chunkVPBMIYO2_cjs.toAsciiDigits(ntn.trim());
|
|
9
|
-
if (
|
|
9
|
+
if (chunk7NTUEHQV_cjs.validateCNIC(trimmed)) {
|
|
10
10
|
const digits = chunkVPBMIYO2_cjs.stripSeparators(trimmed);
|
|
11
11
|
return {
|
|
12
12
|
type: "individual",
|
|
@@ -309,5 +309,88 @@ function wrapBidi(text, direction = "auto") {
|
|
|
309
309
|
const open = direction === "rtl" ? "\u2067" : direction === "ltr" ? "\u2066" : "\u2068";
|
|
310
310
|
return `${open}${text}\u2069`;
|
|
311
311
|
}
|
|
312
|
+
var KEY_DIGRAPHS = {
|
|
313
|
+
kh: "kh",
|
|
314
|
+
gh: "g",
|
|
315
|
+
sh: "sh",
|
|
316
|
+
ch: "ch",
|
|
317
|
+
ph: "f",
|
|
318
|
+
th: "t",
|
|
319
|
+
dh: "d",
|
|
320
|
+
bh: "b",
|
|
321
|
+
jh: "j",
|
|
322
|
+
zh: "z",
|
|
323
|
+
ck: "k"
|
|
324
|
+
};
|
|
325
|
+
var KEY_LETTERS = {
|
|
326
|
+
c: "k",
|
|
327
|
+
q: "k",
|
|
328
|
+
v: "w",
|
|
329
|
+
x: "ks"
|
|
330
|
+
};
|
|
331
|
+
var PLAIN_VOWELS = "aeiou";
|
|
332
|
+
function vowelClass(letter) {
|
|
333
|
+
if (letter === "a" || letter === "e") return "a";
|
|
334
|
+
if (letter === "i" || letter === "y") return "i";
|
|
335
|
+
return "u";
|
|
336
|
+
}
|
|
337
|
+
function firstVowelClass(run, wordStart) {
|
|
338
|
+
if (run.startsWith("ee")) return "i";
|
|
339
|
+
if (wordStart && run.startsWith("e")) return "i";
|
|
340
|
+
if (/^[ao][uw]/.test(run)) return "u";
|
|
341
|
+
if (/^(a[iye]|e[iy])/.test(run)) return "e";
|
|
342
|
+
return vowelClass(run[0]);
|
|
343
|
+
}
|
|
344
|
+
function wordKey(word) {
|
|
345
|
+
let letters = "";
|
|
346
|
+
for (let i = 0; i < word.length; ) {
|
|
347
|
+
const pair = KEY_DIGRAPHS[word.slice(i, i + 2)];
|
|
348
|
+
if (pair !== void 0) {
|
|
349
|
+
letters += pair;
|
|
350
|
+
i += 2;
|
|
351
|
+
} else {
|
|
352
|
+
const letter = word[i];
|
|
353
|
+
letters += KEY_LETTERS[letter] ?? letter;
|
|
354
|
+
i += 1;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
letters = letters.replace(/([^e])\1+/g, "$1");
|
|
358
|
+
const vowel = [];
|
|
359
|
+
for (let i = 0; i < letters.length; i += 1) {
|
|
360
|
+
const letter = letters[i];
|
|
361
|
+
vowel.push(
|
|
362
|
+
PLAIN_VOWELS.includes(letter) || letter === "y" && i > 0 || letter === "w" && i > 0 && vowel[i - 1] === true && !PLAIN_VOWELS.includes(letters[i + 1] ?? "")
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
const last = letters.length - 1;
|
|
366
|
+
if (last > 0 && letters[last] === "h" && vowel[last - 1] === true) {
|
|
367
|
+
letters = letters.slice(0, last);
|
|
368
|
+
vowel.pop();
|
|
369
|
+
}
|
|
370
|
+
let key = "";
|
|
371
|
+
let firstVowelDone = false;
|
|
372
|
+
for (let i = 0; i < letters.length; ) {
|
|
373
|
+
if (!vowel[i]) {
|
|
374
|
+
key += letters[i];
|
|
375
|
+
i += 1;
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
378
|
+
let end = i;
|
|
379
|
+
while (end < letters.length && vowel[end]) end += 1;
|
|
380
|
+
const run = letters.slice(i, end);
|
|
381
|
+
if (!firstVowelDone) {
|
|
382
|
+
key += firstVowelClass(run, i === 0);
|
|
383
|
+
firstVowelDone = true;
|
|
384
|
+
} else if (end === letters.length) {
|
|
385
|
+
key += run.endsWith("ee") ? "i" : vowelClass(run[run.length - 1]);
|
|
386
|
+
}
|
|
387
|
+
i = end;
|
|
388
|
+
}
|
|
389
|
+
return key;
|
|
390
|
+
}
|
|
391
|
+
function romanUrduKey(text) {
|
|
392
|
+
if (typeof text !== "string") return "";
|
|
393
|
+
return text.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g, "").split(/[^a-z]+/).filter((word) => word !== "").map(wordKey).join(" ");
|
|
394
|
+
}
|
|
312
395
|
|
|
313
|
-
export { compareUrdu, isRTL, normalizeRomanUrdu, normalizeText, slugify, toEnglishDigits, toUrduDigits, wrapBidi };
|
|
396
|
+
export { compareUrdu, isRTL, normalizeRomanUrdu, normalizeText, romanUrduKey, slugify, toEnglishDigits, toUrduDigits, wrapBidi };
|
|
@@ -83,7 +83,8 @@ var income_tax_slabs_default = [
|
|
|
83
83
|
fixed: 2142e4,
|
|
84
84
|
rate: 35
|
|
85
85
|
}
|
|
86
|
-
]
|
|
86
|
+
],
|
|
87
|
+
surcharge: null
|
|
87
88
|
},
|
|
88
89
|
{
|
|
89
90
|
taxYear: 2021,
|
|
@@ -164,7 +165,8 @@ var income_tax_slabs_default = [
|
|
|
164
165
|
fixed: 2142e4,
|
|
165
166
|
rate: 35
|
|
166
167
|
}
|
|
167
|
-
]
|
|
168
|
+
],
|
|
169
|
+
surcharge: null
|
|
168
170
|
},
|
|
169
171
|
{
|
|
170
172
|
taxYear: 2022,
|
|
@@ -245,7 +247,8 @@ var income_tax_slabs_default = [
|
|
|
245
247
|
fixed: 2142e4,
|
|
246
248
|
rate: 35
|
|
247
249
|
}
|
|
248
|
-
]
|
|
250
|
+
],
|
|
251
|
+
surcharge: null
|
|
249
252
|
},
|
|
250
253
|
{
|
|
251
254
|
taxYear: 2023,
|
|
@@ -296,7 +299,8 @@ var income_tax_slabs_default = [
|
|
|
296
299
|
fixed: 2955e3,
|
|
297
300
|
rate: 35
|
|
298
301
|
}
|
|
299
|
-
]
|
|
302
|
+
],
|
|
303
|
+
surcharge: null
|
|
300
304
|
},
|
|
301
305
|
{
|
|
302
306
|
taxYear: 2024,
|
|
@@ -341,7 +345,8 @@ var income_tax_slabs_default = [
|
|
|
341
345
|
fixed: 1095e3,
|
|
342
346
|
rate: 35
|
|
343
347
|
}
|
|
344
|
-
]
|
|
348
|
+
],
|
|
349
|
+
surcharge: null
|
|
345
350
|
},
|
|
346
351
|
{
|
|
347
352
|
taxYear: 2025,
|
|
@@ -386,7 +391,13 @@ var income_tax_slabs_default = [
|
|
|
386
391
|
fixed: 7e5,
|
|
387
392
|
rate: 35
|
|
388
393
|
}
|
|
389
|
-
]
|
|
394
|
+
],
|
|
395
|
+
surcharge: {
|
|
396
|
+
rate: 10,
|
|
397
|
+
over: 1e7,
|
|
398
|
+
law: "Income Tax Ordinance 2001, s. 4AB, inserted by the Finance Act 2024, s. 8(2): 10% of the tax under Division I where taxable income exceeds Rs 10 million",
|
|
399
|
+
source: "https://download1.fbr.gov.pk/Docs/2024630146346801FinanceAct-2024.pdf"
|
|
400
|
+
}
|
|
390
401
|
},
|
|
391
402
|
{
|
|
392
403
|
taxYear: 2026,
|
|
@@ -431,7 +442,13 @@ var income_tax_slabs_default = [
|
|
|
431
442
|
fixed: 616e3,
|
|
432
443
|
rate: 35
|
|
433
444
|
}
|
|
434
|
-
]
|
|
445
|
+
],
|
|
446
|
+
surcharge: {
|
|
447
|
+
rate: 9,
|
|
448
|
+
over: 1e7,
|
|
449
|
+
law: "Income Tax Ordinance 2001, s. 4AB, proviso added by the Finance Act 2025: 9% for an individual with income under the head Salary, where taxable income exceeds Rs 10 million",
|
|
450
|
+
source: "https://download1.fbr.gov.pk/Docs/2025881983148210Income-Tax-Ordinance,-2001-Amended-upto-31.07.2025.pdf"
|
|
451
|
+
}
|
|
435
452
|
},
|
|
436
453
|
{
|
|
437
454
|
taxYear: 2027,
|
|
@@ -488,7 +505,13 @@ var income_tax_slabs_default = [
|
|
|
488
505
|
fixed: 1424e3,
|
|
489
506
|
rate: 35
|
|
490
507
|
}
|
|
491
|
-
]
|
|
508
|
+
],
|
|
509
|
+
surcharge: {
|
|
510
|
+
rate: 0,
|
|
511
|
+
over: 1e7,
|
|
512
|
+
law: "Income Tax Ordinance 2001, s. 4AB, proviso substituted by the Finance Act 2026, s. 5(2)(b): no surcharge for an individual with income under the head Salary",
|
|
513
|
+
source: "https://download1.fbr.gov.pk/Docs/20266291261044366FinanceAct2026.pdf"
|
|
514
|
+
}
|
|
492
515
|
}
|
|
493
516
|
];
|
|
494
517
|
|
|
@@ -519,7 +542,8 @@ function findYear(options) {
|
|
|
519
542
|
}
|
|
520
543
|
var copyYear = (year) => ({
|
|
521
544
|
...year,
|
|
522
|
-
slabs: year.slabs.map((slab) => ({ ...slab }))
|
|
545
|
+
slabs: year.slabs.map((slab) => ({ ...slab })),
|
|
546
|
+
surcharge: year.surcharge === null ? null : { ...year.surcharge }
|
|
523
547
|
});
|
|
524
548
|
function getSalaryTaxSlabs(taxYear) {
|
|
525
549
|
const year = findYear(taxYear === void 0 ? void 0 : { taxYear });
|
|
@@ -528,7 +552,7 @@ function getSalaryTaxSlabs(taxYear) {
|
|
|
528
552
|
function getSalaryTaxYears() {
|
|
529
553
|
return YEARS.map((y) => y.taxYear);
|
|
530
554
|
}
|
|
531
|
-
function compute(incomePaisa, year) {
|
|
555
|
+
function compute(incomePaisa, year, includeSurcharge) {
|
|
532
556
|
const slabs = year.slabs;
|
|
533
557
|
let slab = slabs[0];
|
|
534
558
|
for (const candidate of slabs) {
|
|
@@ -537,10 +561,18 @@ function compute(incomePaisa, year) {
|
|
|
537
561
|
const rateBp = Math.round(slab.rate * 100);
|
|
538
562
|
const above = BigInt(incomePaisa - slab.over * 100);
|
|
539
563
|
const taxPaisa = incomePaisa > slab.over * 100 ? slab.fixed * 100 + chunkSF4ECUZ6_cjs.divideHalfUp(above * BigInt(rateBp), 10000n) : slab.fixed * 100;
|
|
564
|
+
const surcharge = year.surcharge;
|
|
565
|
+
const surchargePaisa = includeSurcharge && surcharge !== null && surcharge.rate > 0 && incomePaisa > surcharge.over * 100 ? chunkSF4ECUZ6_cjs.divideHalfUp(
|
|
566
|
+
BigInt(taxPaisa) * BigInt(Math.round(surcharge.rate * 100)),
|
|
567
|
+
10000n
|
|
568
|
+
) : 0;
|
|
569
|
+
const totalPaisa = taxPaisa + surchargePaisa;
|
|
540
570
|
return {
|
|
541
571
|
tax: chunkSF4ECUZ6_cjs.fromPaisa(taxPaisa),
|
|
542
|
-
|
|
543
|
-
|
|
572
|
+
surcharge: chunkSF4ECUZ6_cjs.fromPaisa(surchargePaisa),
|
|
573
|
+
total: chunkSF4ECUZ6_cjs.fromPaisa(totalPaisa),
|
|
574
|
+
monthly: chunkSF4ECUZ6_cjs.fromPaisa(chunkSF4ECUZ6_cjs.divideHalfUp(BigInt(totalPaisa), 12n)),
|
|
575
|
+
effectiveRate: incomePaisa === 0 ? 0 : chunkSF4ECUZ6_cjs.divideHalfUp(BigInt(totalPaisa) * 10000n, BigInt(incomePaisa)) / 100,
|
|
544
576
|
slab: { ...slab },
|
|
545
577
|
taxYear: year.taxYear
|
|
546
578
|
};
|
|
@@ -549,13 +581,13 @@ function calculateSalaryTax(annualIncome, options) {
|
|
|
549
581
|
const paisa = chunkSF4ECUZ6_cjs.toUnits(annualIncome, 2);
|
|
550
582
|
if (paisa === null) return null;
|
|
551
583
|
const year = findYear(options);
|
|
552
|
-
return year ? compute(paisa, year) : null;
|
|
584
|
+
return year ? compute(paisa, year, options?.includeSurcharge === true) : null;
|
|
553
585
|
}
|
|
554
586
|
function calculateMonthlySalaryTax(monthlySalary, options) {
|
|
555
587
|
const paisa = chunkSF4ECUZ6_cjs.toUnits(monthlySalary, 2);
|
|
556
588
|
if (paisa === null) return null;
|
|
557
589
|
const year = findYear(options);
|
|
558
|
-
return year ? compute(paisa * 12, year) : null;
|
|
590
|
+
return year ? compute(paisa * 12, year, options?.includeSurcharge === true) : null;
|
|
559
591
|
}
|
|
560
592
|
|
|
561
593
|
exports.calculateMonthlySalaryTax = calculateMonthlySalaryTax;
|
package/dist/class-validator.cjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk36K225SE_cjs = require('./chunk-36K225SE.cjs');
|
|
4
4
|
require('./chunk-ESKXG7Y6.cjs');
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
5
|
+
require('./chunk-4YLSPXBZ.cjs');
|
|
6
|
+
require('./chunk-VZIBHQC7.cjs');
|
|
7
7
|
require('./chunk-SQIHFEXI.cjs');
|
|
8
8
|
require('./chunk-DHOP7LQX.cjs');
|
|
9
9
|
require('./chunk-MTS6SVNP.cjs');
|
|
10
|
-
require('./chunk-
|
|
10
|
+
require('./chunk-VSIVT5RT.cjs');
|
|
11
11
|
require('./chunk-YTLE5K7G.cjs');
|
|
12
12
|
require('./chunk-7E7L3NYS.cjs');
|
|
13
13
|
require('./chunk-QFPEFD67.cjs');
|
|
14
14
|
require('./chunk-I7UUPD3G.cjs');
|
|
15
|
-
require('./chunk-
|
|
15
|
+
require('./chunk-7NTUEHQV.cjs');
|
|
16
16
|
require('./chunk-NLSIAPZG.cjs');
|
|
17
17
|
require('./chunk-33GOK7EE.cjs');
|
|
18
18
|
require('./chunk-E6GWBOKV.cjs');
|
|
@@ -20,15 +20,20 @@ require('./chunk-VPBMIYO2.cjs');
|
|
|
20
20
|
var classValidator = require('class-validator');
|
|
21
21
|
|
|
22
22
|
function decorator(name) {
|
|
23
|
-
const rule =
|
|
23
|
+
const rule = chunk36K225SE_cjs.RULES[name];
|
|
24
24
|
return (options = {}) => (target, propertyName) => {
|
|
25
|
+
const { services, ...validationOptions } = options;
|
|
26
|
+
const ruleOptions = { services: services === true };
|
|
25
27
|
classValidator.registerDecorator({
|
|
26
28
|
name: `pk-${name}`,
|
|
27
29
|
target: target.constructor,
|
|
28
30
|
propertyName,
|
|
29
|
-
options: {
|
|
31
|
+
options: {
|
|
32
|
+
...validationOptions,
|
|
33
|
+
message: options.message ?? rule.message
|
|
34
|
+
},
|
|
30
35
|
validator: {
|
|
31
|
-
validate: (value) => typeof value === "string" && rule.test(value)
|
|
36
|
+
validate: (value) => typeof value === "string" && rule.test(value, ruleOptions)
|
|
32
37
|
}
|
|
33
38
|
});
|
|
34
39
|
};
|
|
@@ -2,9 +2,12 @@ import { ValidationOptions } from 'class-validator';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Options for the decorators: class-validator's own options (`groups`,
|
|
5
|
-
* `each`, `always`, `context`), plus a custom `message`.
|
|
5
|
+
* `each`, `always`, `context`), plus a custom `message`. `IsPakLandline`
|
|
6
|
+
* also takes `services: true` to accept UAN, toll-free and premium numbers.
|
|
6
7
|
*/
|
|
7
|
-
type DecoratorOptions = ValidationOptions
|
|
8
|
+
type DecoratorOptions = ValidationOptions & {
|
|
9
|
+
services?: boolean;
|
|
10
|
+
};
|
|
8
11
|
/**
|
|
9
12
|
* class-validator decorators for Pakistani identifiers. They work in NestJS
|
|
10
13
|
* DTOs with the built-in `ValidationPipe`; no NestJS package is needed.
|
|
@@ -2,9 +2,12 @@ import { ValidationOptions } from 'class-validator';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Options for the decorators: class-validator's own options (`groups`,
|
|
5
|
-
* `each`, `always`, `context`), plus a custom `message`.
|
|
5
|
+
* `each`, `always`, `context`), plus a custom `message`. `IsPakLandline`
|
|
6
|
+
* also takes `services: true` to accept UAN, toll-free and premium numbers.
|
|
6
7
|
*/
|
|
7
|
-
type DecoratorOptions = ValidationOptions
|
|
8
|
+
type DecoratorOptions = ValidationOptions & {
|
|
9
|
+
services?: boolean;
|
|
10
|
+
};
|
|
8
11
|
/**
|
|
9
12
|
* class-validator decorators for Pakistani identifiers. They work in NestJS
|
|
10
13
|
* DTOs with the built-in `ValidationPipe`; no NestJS package is needed.
|