pakdatakit 2.3.0 → 2.5.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 (96) hide show
  1. package/DATA.md +212 -3
  2. package/LICENSE +1 -1
  3. package/NOTICE +14 -0
  4. package/README.md +426 -207
  5. package/dist/address.cjs +5 -4
  6. package/dist/address.js +3 -2
  7. package/dist/bills.cjs +19 -0
  8. package/dist/bills.d.cts +63 -0
  9. package/dist/bills.d.ts +63 -0
  10. package/dist/bills.js +2 -0
  11. package/dist/{chunk-OKMBYX3F.cjs → chunk-33GOK7EE.cjs} +2 -910
  12. package/dist/chunk-34U2ZMHR.js +194 -0
  13. package/dist/chunk-4GSBHJX6.js +165 -0
  14. package/dist/chunk-5DDHO5Z7.cjs +565 -0
  15. package/dist/chunk-5EY5DQS7.js +51 -0
  16. package/dist/chunk-5RGX4DWF.js +559 -0
  17. package/dist/chunk-5UCRHVI4.cjs +302 -0
  18. package/dist/{chunk-TQP2T33V.js → chunk-B7DOQ5QF.js} +2 -1
  19. package/dist/chunk-CF6AMRBU.cjs +198 -0
  20. package/dist/chunk-CZOZB4K3.js +61 -0
  21. package/dist/chunk-E2XU6NOW.js +909 -0
  22. package/dist/chunk-E6GWBOKV.cjs +911 -0
  23. package/dist/chunk-EA3SIHYT.js +313 -0
  24. package/dist/{chunk-YTSMFGTW.js → chunk-IDTRFOQW.js} +8 -3
  25. package/dist/chunk-OTI7HY55.js +297 -0
  26. package/dist/{chunk-J5ARB4TE.cjs → chunk-QFPEFD67.cjs} +5 -4
  27. package/dist/chunk-SF4ECUZ6.cjs +56 -0
  28. package/dist/chunk-UYFTXD4P.js +168 -0
  29. package/dist/{chunk-TBTWZC74.cjs → chunk-XCFZKCV2.cjs} +8 -3
  30. package/dist/{chunk-N4S22XX3.js → chunk-XOTCIXY6.js} +2 -909
  31. package/dist/chunk-XVEG53NN.cjs +322 -0
  32. package/dist/chunk-YDUXIENX.cjs +172 -0
  33. package/dist/chunk-YPAWNWFD.cjs +168 -0
  34. package/dist/chunk-YQFI7W3I.cjs +65 -0
  35. package/dist/class-validator.cjs +16 -8
  36. package/dist/class-validator.d.cts +7 -1
  37. package/dist/class-validator.d.ts +7 -1
  38. package/dist/class-validator.js +15 -8
  39. package/dist/cli.js +1 -1
  40. package/dist/courier.cjs +16 -0
  41. package/dist/courier.d.cts +51 -0
  42. package/dist/courier.d.ts +51 -0
  43. package/dist/courier.js +3 -0
  44. package/dist/fbr-invoice.cjs +25 -0
  45. package/dist/fbr-invoice.d.cts +170 -0
  46. package/dist/fbr-invoice.d.ts +170 -0
  47. package/dist/fbr-invoice.js +4 -0
  48. package/dist/geo.cjs +11 -10
  49. package/dist/geo.js +2 -1
  50. package/dist/incometax.cjs +27 -0
  51. package/dist/incometax.d.cts +91 -0
  52. package/dist/incometax.d.ts +91 -0
  53. package/dist/incometax.js +2 -0
  54. package/dist/index.cjs +227 -123
  55. package/dist/index.d.cts +8 -2
  56. package/dist/index.d.ts +8 -2
  57. package/dist/index.js +21 -13
  58. package/dist/input.cjs +8 -8
  59. package/dist/input.js +2 -2
  60. package/dist/joi.cjs +14 -8
  61. package/dist/joi.d.cts +1 -0
  62. package/dist/joi.d.ts +1 -0
  63. package/dist/joi.js +13 -7
  64. package/dist/quality.cjs +25 -0
  65. package/dist/quality.d.cts +62 -0
  66. package/dist/quality.d.ts +62 -0
  67. package/dist/quality.js +8 -0
  68. package/dist/salestax.cjs +20 -0
  69. package/dist/salestax.d.cts +106 -0
  70. package/dist/salestax.d.ts +106 -0
  71. package/dist/salestax.js +3 -0
  72. package/dist/superstruct.cjs +14 -8
  73. package/dist/superstruct.d.cts +1 -0
  74. package/dist/superstruct.d.ts +1 -0
  75. package/dist/superstruct.js +13 -7
  76. package/dist/text.cjs +21 -5
  77. package/dist/text.d.cts +90 -1
  78. package/dist/text.d.ts +90 -1
  79. package/dist/text.js +1 -1
  80. package/dist/valibot.cjs +14 -8
  81. package/dist/valibot.d.cts +1 -0
  82. package/dist/valibot.d.ts +1 -0
  83. package/dist/valibot.js +13 -7
  84. package/dist/yup.cjs +14 -8
  85. package/dist/yup.d.cts +1 -0
  86. package/dist/yup.d.ts +1 -0
  87. package/dist/yup.js +13 -7
  88. package/dist/zod.cjs +14 -8
  89. package/dist/zod.d.cts +1 -0
  90. package/dist/zod.d.ts +1 -0
  91. package/dist/zod.js +13 -7
  92. package/package.json +74 -11
  93. package/dist/chunk-JKE4AMSZ.js +0 -47
  94. package/dist/chunk-KEHCTYLO.cjs +0 -52
  95. package/dist/{chunk-A3HBEBXY.js → chunk-7DY26QPN.js} +1 -1
  96. package/dist/{chunk-FRBPAGEJ.cjs → chunk-TVL6RDAU.cjs} +1 -1
package/dist/input.js CHANGED
@@ -1,5 +1,5 @@
1
- export { checkCNICInput, checkIBANInput, checkPhoneInput, formatCNICInput, formatIBANInput, formatPhoneInput } from './chunk-A3HBEBXY.js';
1
+ export { checkCNICInput, checkIBANInput, checkPhoneInput, formatCNICInput, formatIBANInput, formatPhoneInput } from './chunk-7DY26QPN.js';
2
+ import './chunk-IBZPJS4H.js';
2
3
  import './chunk-P7LVE2TF.js';
3
4
  import './chunk-EEVNLTB4.js';
4
- import './chunk-IBZPJS4H.js';
5
5
  import './chunk-ENQ7O7VW.js';
package/dist/joi.cjs CHANGED
@@ -1,15 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var chunkTBTWZC74_cjs = require('./chunk-TBTWZC74.cjs');
4
- require('./chunk-SQIHFEXI.cjs');
5
- require('./chunk-AUQFA7EE.cjs');
6
- require('./chunk-7E7L3NYS.cjs');
3
+ var chunkXCFZKCV2_cjs = require('./chunk-XCFZKCV2.cjs');
7
4
  require('./chunk-ESKXG7Y6.cjs');
5
+ require('./chunk-YDUXIENX.cjs');
6
+ require('./chunk-H6M6L26S.cjs');
7
+ require('./chunk-SQIHFEXI.cjs');
8
+ require('./chunk-DHOP7LQX.cjs');
8
9
  require('./chunk-MTS6SVNP.cjs');
10
+ require('./chunk-AUQFA7EE.cjs');
9
11
  require('./chunk-YTLE5K7G.cjs');
10
- require('./chunk-H6M6L26S.cjs');
12
+ require('./chunk-7E7L3NYS.cjs');
13
+ require('./chunk-QFPEFD67.cjs');
14
+ require('./chunk-I7UUPD3G.cjs');
11
15
  require('./chunk-HTCSHHOR.cjs');
12
- require('./chunk-DHOP7LQX.cjs');
16
+ require('./chunk-33GOK7EE.cjs');
17
+ require('./chunk-E6GWBOKV.cjs');
13
18
  require('./chunk-VPBMIYO2.cjs');
14
19
  var Joi = require('joi');
15
20
 
@@ -18,7 +23,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
18
23
  var Joi__default = /*#__PURE__*/_interopDefault(Joi);
19
24
 
20
25
  function schema(name) {
21
- const rule = chunkTBTWZC74_cjs.RULES[name];
26
+ const rule = chunkXCFZKCV2_cjs.RULES[name];
22
27
  return (options = {}) => Joi__default.default.string().custom(
23
28
  (value, helpers) => rule.test(value) ? value : helpers.message({ custom: options.message ?? rule.message })
24
29
  );
@@ -31,7 +36,8 @@ var pk = {
31
36
  strn: schema("strn"),
32
37
  landline: schema("landline"),
33
38
  passport: schema("passport"),
34
- vehiclePlate: schema("vehiclePlate")
39
+ vehiclePlate: schema("vehiclePlate"),
40
+ codPhone: schema("codPhone")
35
41
  };
36
42
 
37
43
  exports.pk = pk;
package/dist/joi.d.cts CHANGED
@@ -19,6 +19,7 @@ declare const pk: {
19
19
  landline: (options?: AdapterOptions) => Joi.StringSchema<string>;
20
20
  passport: (options?: AdapterOptions) => Joi.StringSchema<string>;
21
21
  vehiclePlate: (options?: AdapterOptions) => Joi.StringSchema<string>;
22
+ codPhone: (options?: AdapterOptions) => Joi.StringSchema<string>;
22
23
  };
23
24
 
24
25
  export { AdapterOptions, pk };
package/dist/joi.d.ts CHANGED
@@ -19,6 +19,7 @@ declare const pk: {
19
19
  landline: (options?: AdapterOptions) => Joi.StringSchema<string>;
20
20
  passport: (options?: AdapterOptions) => Joi.StringSchema<string>;
21
21
  vehiclePlate: (options?: AdapterOptions) => Joi.StringSchema<string>;
22
+ codPhone: (options?: AdapterOptions) => Joi.StringSchema<string>;
22
23
  };
23
24
 
24
25
  export { AdapterOptions, pk };
package/dist/joi.js CHANGED
@@ -1,13 +1,18 @@
1
- import { RULES } from './chunk-YTSMFGTW.js';
2
- import './chunk-RZQJAZKC.js';
3
- import './chunk-LQHM3ADX.js';
4
- import './chunk-E6HSKRAE.js';
1
+ import { RULES } from './chunk-IDTRFOQW.js';
5
2
  import './chunk-S274QFFB.js';
3
+ import './chunk-UYFTXD4P.js';
4
+ import './chunk-CEPNSHIC.js';
5
+ import './chunk-RZQJAZKC.js';
6
+ import './chunk-IBZPJS4H.js';
6
7
  import './chunk-V2XE3NCG.js';
8
+ import './chunk-LQHM3ADX.js';
7
9
  import './chunk-P7LVE2TF.js';
8
- import './chunk-CEPNSHIC.js';
10
+ import './chunk-E6HSKRAE.js';
11
+ import './chunk-B7DOQ5QF.js';
12
+ import './chunk-33QMFE2Z.js';
9
13
  import './chunk-EEVNLTB4.js';
10
- import './chunk-IBZPJS4H.js';
14
+ import './chunk-XOTCIXY6.js';
15
+ import './chunk-E2XU6NOW.js';
11
16
  import './chunk-ENQ7O7VW.js';
12
17
  import Joi from 'joi';
13
18
 
@@ -25,7 +30,8 @@ var pk = {
25
30
  strn: schema("strn"),
26
31
  landline: schema("landline"),
27
32
  passport: schema("passport"),
28
- vehiclePlate: schema("vehiclePlate")
33
+ vehiclePlate: schema("vehiclePlate"),
34
+ codPhone: schema("codPhone")
29
35
  };
30
36
 
31
37
  export { pk };
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ var chunkYDUXIENX_cjs = require('./chunk-YDUXIENX.cjs');
4
+ require('./chunk-AUQFA7EE.cjs');
5
+ require('./chunk-YTLE5K7G.cjs');
6
+ require('./chunk-QFPEFD67.cjs');
7
+ require('./chunk-I7UUPD3G.cjs');
8
+ require('./chunk-33GOK7EE.cjs');
9
+ require('./chunk-E6GWBOKV.cjs');
10
+ require('./chunk-VPBMIYO2.cjs');
11
+
12
+
13
+
14
+ Object.defineProperty(exports, "ADDRESS_WEIGHTS", {
15
+ enumerable: true,
16
+ get: function () { return chunkYDUXIENX_cjs.ADDRESS_WEIGHTS; }
17
+ });
18
+ Object.defineProperty(exports, "phoneRiskSignals", {
19
+ enumerable: true,
20
+ get: function () { return chunkYDUXIENX_cjs.phoneRiskSignals; }
21
+ });
22
+ Object.defineProperty(exports, "scoreAddress", {
23
+ enumerable: true,
24
+ get: function () { return chunkYDUXIENX_cjs.scoreAddress; }
25
+ });
@@ -0,0 +1,62 @@
1
+ import { ParsedAddress } from './address.cjs';
2
+
3
+ /** A part of a delivery address that {@link scoreAddress} looks for. */
4
+ type AddressPart = 'city' | 'houseNumber' | 'street' | 'area' | 'postalCode' | 'landmark';
5
+ /** Result of {@link scoreAddress}. */
6
+ interface AddressScore {
7
+ /** 0 (unusable) to 100 (every part present and consistent). */
8
+ score: number;
9
+ /** Parts not found, in the order of {@link ADDRESS_WEIGHTS}. */
10
+ missing: AddressPart[];
11
+ /** The address as `parseAddress` reads it, with any extra warnings. */
12
+ parsed: ParsedAddress;
13
+ }
14
+ /**
15
+ * Points for each part of an address. They add up to 100. A postal code
16
+ * scores in full only when it is a known post office code; an unknown one
17
+ * scores 5.
18
+ */
19
+ declare const ADDRESS_WEIGHTS: Readonly<Record<AddressPart, number>>;
20
+ /**
21
+ * Scores how complete a free-form Pakistani delivery address is, for cash on
22
+ * delivery and other courier use.
23
+ *
24
+ * Built on {@link parseAddress}. It looks for a city, a house, plot or flat
25
+ * number, a street, an area, a postal code and a landmark ("near", "opp",
26
+ * "nazd", "qareeb", "سامنے" …), and adds up {@link ADDRESS_WEIGHTS}. A postal
27
+ * code that is a known post office raises the score more than an unknown
28
+ * one, and a post office in a different province from the city lowers it
29
+ * (with a warning in `parsed.warnings`).
30
+ *
31
+ * This is a heuristic: it says how much an address tells a rider, not whether
32
+ * the address exists. It never throws.
33
+ *
34
+ * @example
35
+ * scoreAddress('House 12, Street 4, Block B, Gulberg III, near Liberty Market, Lahore 54660');
36
+ * // { score: 100, missing: [], parsed: { … } }
37
+ */
38
+ declare function scoreAddress(input: string): AddressScore;
39
+ /** A reason to double-check a phone number given for a delivery. */
40
+ type PhoneRiskFlag = 'invalid' | 'landline' | 'not-mobile' | 'repeated-digits' | 'sequential-digits' | 'test-number';
41
+ /**
42
+ * Flags a phone number that a courier cannot reach by SMS or call, or that
43
+ * looks made up. Pure heuristics on the number itself: no list of real
44
+ * numbers, no personal data, no network call.
45
+ *
46
+ * - `invalid`: not a Pakistani phone number.
47
+ * - `landline`: a fixed-line number (no SMS, often unanswered).
48
+ * - `not-mobile`: a UAN, toll-free or other service number.
49
+ * - `repeated-digits`: the 7-digit subscriber part uses at most two
50
+ * different digits (`0300-0000000`, `0300-1111112`).
51
+ * - `sequential-digits`: the subscriber part is a run such as `1234567` or
52
+ * `7654321`.
53
+ * - `test-number`: a placeholder often typed into forms (`03XX-1234567`,
54
+ * `03XX-7654321`, `0312-3456789`).
55
+ *
56
+ * A valid mobile number with nothing suspicious returns `[]`. It never
57
+ * throws.
58
+ */
59
+ declare function phoneRiskSignals(input: string): PhoneRiskFlag[];
60
+
61
+ export { ADDRESS_WEIGHTS, phoneRiskSignals, scoreAddress };
62
+ export type { AddressPart, AddressScore, PhoneRiskFlag };
@@ -0,0 +1,62 @@
1
+ import { ParsedAddress } from './address.js';
2
+
3
+ /** A part of a delivery address that {@link scoreAddress} looks for. */
4
+ type AddressPart = 'city' | 'houseNumber' | 'street' | 'area' | 'postalCode' | 'landmark';
5
+ /** Result of {@link scoreAddress}. */
6
+ interface AddressScore {
7
+ /** 0 (unusable) to 100 (every part present and consistent). */
8
+ score: number;
9
+ /** Parts not found, in the order of {@link ADDRESS_WEIGHTS}. */
10
+ missing: AddressPart[];
11
+ /** The address as `parseAddress` reads it, with any extra warnings. */
12
+ parsed: ParsedAddress;
13
+ }
14
+ /**
15
+ * Points for each part of an address. They add up to 100. A postal code
16
+ * scores in full only when it is a known post office code; an unknown one
17
+ * scores 5.
18
+ */
19
+ declare const ADDRESS_WEIGHTS: Readonly<Record<AddressPart, number>>;
20
+ /**
21
+ * Scores how complete a free-form Pakistani delivery address is, for cash on
22
+ * delivery and other courier use.
23
+ *
24
+ * Built on {@link parseAddress}. It looks for a city, a house, plot or flat
25
+ * number, a street, an area, a postal code and a landmark ("near", "opp",
26
+ * "nazd", "qareeb", "سامنے" …), and adds up {@link ADDRESS_WEIGHTS}. A postal
27
+ * code that is a known post office raises the score more than an unknown
28
+ * one, and a post office in a different province from the city lowers it
29
+ * (with a warning in `parsed.warnings`).
30
+ *
31
+ * This is a heuristic: it says how much an address tells a rider, not whether
32
+ * the address exists. It never throws.
33
+ *
34
+ * @example
35
+ * scoreAddress('House 12, Street 4, Block B, Gulberg III, near Liberty Market, Lahore 54660');
36
+ * // { score: 100, missing: [], parsed: { … } }
37
+ */
38
+ declare function scoreAddress(input: string): AddressScore;
39
+ /** A reason to double-check a phone number given for a delivery. */
40
+ type PhoneRiskFlag = 'invalid' | 'landline' | 'not-mobile' | 'repeated-digits' | 'sequential-digits' | 'test-number';
41
+ /**
42
+ * Flags a phone number that a courier cannot reach by SMS or call, or that
43
+ * looks made up. Pure heuristics on the number itself: no list of real
44
+ * numbers, no personal data, no network call.
45
+ *
46
+ * - `invalid`: not a Pakistani phone number.
47
+ * - `landline`: a fixed-line number (no SMS, often unanswered).
48
+ * - `not-mobile`: a UAN, toll-free or other service number.
49
+ * - `repeated-digits`: the 7-digit subscriber part uses at most two
50
+ * different digits (`0300-0000000`, `0300-1111112`).
51
+ * - `sequential-digits`: the subscriber part is a run such as `1234567` or
52
+ * `7654321`.
53
+ * - `test-number`: a placeholder often typed into forms (`03XX-1234567`,
54
+ * `03XX-7654321`, `0312-3456789`).
55
+ *
56
+ * A valid mobile number with nothing suspicious returns `[]`. It never
57
+ * throws.
58
+ */
59
+ declare function phoneRiskSignals(input: string): PhoneRiskFlag[];
60
+
61
+ export { ADDRESS_WEIGHTS, phoneRiskSignals, scoreAddress };
62
+ export type { AddressPart, AddressScore, PhoneRiskFlag };
@@ -0,0 +1,8 @@
1
+ export { ADDRESS_WEIGHTS, phoneRiskSignals, scoreAddress } from './chunk-UYFTXD4P.js';
2
+ import './chunk-LQHM3ADX.js';
3
+ import './chunk-P7LVE2TF.js';
4
+ import './chunk-B7DOQ5QF.js';
5
+ import './chunk-33QMFE2Z.js';
6
+ import './chunk-XOTCIXY6.js';
7
+ import './chunk-E2XU6NOW.js';
8
+ import './chunk-ENQ7O7VW.js';
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ var chunkCF6AMRBU_cjs = require('./chunk-CF6AMRBU.cjs');
4
+ require('./chunk-SF4ECUZ6.cjs');
5
+ require('./chunk-VPBMIYO2.cjs');
6
+
7
+
8
+
9
+ Object.defineProperty(exports, "calculateSalesTax", {
10
+ enumerable: true,
11
+ get: function () { return chunkCF6AMRBU_cjs.calculateSalesTax; }
12
+ });
13
+ Object.defineProperty(exports, "getSalesTaxRate", {
14
+ enumerable: true,
15
+ get: function () { return chunkCF6AMRBU_cjs.getSalesTaxRate; }
16
+ });
17
+ Object.defineProperty(exports, "splitInclusive", {
18
+ enumerable: true,
19
+ get: function () { return chunkCF6AMRBU_cjs.splitInclusive; }
20
+ });
@@ -0,0 +1,106 @@
1
+ /** What is taxed: goods (federal sales tax) or services (provincial or ICT). */
2
+ type SalesTaxKind = 'goods' | 'services';
3
+ /** One standard rate and the period it applied. */
4
+ interface SalesTaxRate {
5
+ kind: SalesTaxKind;
6
+ /** `FBR`, `PRA`, `SRB`, `KPRA` or `BRA`. FBR also collects ICT's tax on services. */
7
+ authority: string;
8
+ /** For services: the province or `Islamabad Capital Territory`. `null` for goods. */
9
+ province: string | null;
10
+ /** Percent, e.g. `18`. */
11
+ rate: number;
12
+ /** First day it applied (`YYYY-MM-DD`). Coverage starts on 1 July 2019. */
13
+ from: string;
14
+ /** Last day it applied, or `null` if it still applies. */
15
+ to: string | null;
16
+ /** The law that sets it. */
17
+ law: string;
18
+ /** Official document. */
19
+ source: string;
20
+ }
21
+ /** Options for {@link getSalesTaxRate}. */
22
+ interface SalesTaxRateQuery {
23
+ kind: SalesTaxKind;
24
+ /**
25
+ * For services: Punjab, Sindh, Khyber Pakhtunkhwa (`KP`, `KPK`),
26
+ * Balochistan or Islamabad Capital Territory (`ICT`, `Islamabad`). For
27
+ * goods it may be left out; Azad Jammu and Kashmir and Gilgit-Baltistan
28
+ * return `null`.
29
+ */
30
+ province?: string;
31
+ /** `YYYY-MM-DD` or a `Date` (its local calendar date). Defaults to today. */
32
+ date?: string | Date;
33
+ }
34
+ /** Result of {@link calculateSalesTax} and {@link splitInclusive}. */
35
+ interface SalesTaxAmounts {
36
+ /** Value excluding tax, in rupees (2 decimals at most). */
37
+ net: number;
38
+ tax: number;
39
+ /** Value including tax. */
40
+ gross: number;
41
+ /** Percent used. */
42
+ rate: number;
43
+ }
44
+ /** Options for {@link calculateSalesTax}: a `rate`, or a `province`/`kind` to look one up. */
45
+ interface SalesTaxOptions {
46
+ /** Percent, 0 to 100, at most 2 decimals. Takes precedence over `province`. */
47
+ rate?: number;
48
+ province?: string;
49
+ /** Defaults to `services` when a province is given. */
50
+ kind?: SalesTaxKind;
51
+ date?: string | Date;
52
+ /** `true` if `amount` already includes the tax. */
53
+ inclusive?: boolean;
54
+ }
55
+ /**
56
+ * Returns the standard sales tax rate for goods (federal, Sales Tax Act
57
+ * 1990) or for services in a province or Islamabad Capital Territory, on a
58
+ * given date.
59
+ *
60
+ * Only standard rates are covered, from 1 July 2019. Reduced, higher and
61
+ * sector rates (telecom, restaurants paid by card, Third Schedule goods and
62
+ * so on) are not. Every rate comes from the authority's own Act or Finance
63
+ * Act; see DATA.md.
64
+ *
65
+ * @returns The rate and its source, or `null` for an unknown province or
66
+ * kind, an invalid date, or a date before 1 July 2019. Never throws.
67
+ *
68
+ * @example
69
+ * getSalesTaxRate({ kind: 'goods', date: '2026-11-18' })?.rate; // 18
70
+ * getSalesTaxRate({ kind: 'services', province: 'Sindh', date: '2024-06-30' })?.rate; // 13
71
+ */
72
+ declare function getSalesTaxRate(query: SalesTaxRateQuery): SalesTaxRate | null;
73
+ /**
74
+ * Splits an amount that includes sales tax into its value and tax.
75
+ *
76
+ * The value is rounded half up to the paisa, and the tax is the rest, so
77
+ * `net + tax` is always `gross`.
78
+ *
79
+ * @param gross - Amount including tax, 0 to 1 trillion rupees
80
+ * @param rate - Percent, 0 to 100, at most 2 decimals
81
+ * @returns The split, or `null` for an invalid amount or rate. Never throws.
82
+ *
83
+ * @example
84
+ * splitInclusive(1180, 18); // { net: 1000, tax: 180, gross: 1180, rate: 18 }
85
+ */
86
+ declare function splitInclusive(gross: number, rate: number): SalesTaxAmounts | null;
87
+ /**
88
+ * Adds sales tax to an amount, or splits it out when `inclusive` is set.
89
+ *
90
+ * Give a `rate`, or a `province` (and `kind`, default `services`, and
91
+ * `date`) to use the standard rate from {@link getSalesTaxRate}. The tax is
92
+ * rounded half up to the paisa.
93
+ *
94
+ * @param amount - 0 to 1 trillion rupees
95
+ * @returns The amounts, or `null` if the amount, rate or province is
96
+ * invalid or no rate applies. Never throws.
97
+ *
98
+ * @example
99
+ * calculateSalesTax(1000, { rate: 18 }); // { net: 1000, tax: 180, gross: 1180, rate: 18 }
100
+ * calculateSalesTax(1000, { province: 'Punjab', date: '2026-11-18' }); // { net: 1000, tax: 160, gross: 1160, rate: 16 }
101
+ * calculateSalesTax(1150, { province: 'Sindh', date: '2026-11-18', inclusive: true }); // { net: 1000, tax: 150, gross: 1150, rate: 15 }
102
+ */
103
+ declare function calculateSalesTax(amount: number, options: SalesTaxOptions): SalesTaxAmounts | null;
104
+
105
+ export { calculateSalesTax, getSalesTaxRate, splitInclusive };
106
+ export type { SalesTaxAmounts, SalesTaxKind, SalesTaxOptions, SalesTaxRate, SalesTaxRateQuery };
@@ -0,0 +1,106 @@
1
+ /** What is taxed: goods (federal sales tax) or services (provincial or ICT). */
2
+ type SalesTaxKind = 'goods' | 'services';
3
+ /** One standard rate and the period it applied. */
4
+ interface SalesTaxRate {
5
+ kind: SalesTaxKind;
6
+ /** `FBR`, `PRA`, `SRB`, `KPRA` or `BRA`. FBR also collects ICT's tax on services. */
7
+ authority: string;
8
+ /** For services: the province or `Islamabad Capital Territory`. `null` for goods. */
9
+ province: string | null;
10
+ /** Percent, e.g. `18`. */
11
+ rate: number;
12
+ /** First day it applied (`YYYY-MM-DD`). Coverage starts on 1 July 2019. */
13
+ from: string;
14
+ /** Last day it applied, or `null` if it still applies. */
15
+ to: string | null;
16
+ /** The law that sets it. */
17
+ law: string;
18
+ /** Official document. */
19
+ source: string;
20
+ }
21
+ /** Options for {@link getSalesTaxRate}. */
22
+ interface SalesTaxRateQuery {
23
+ kind: SalesTaxKind;
24
+ /**
25
+ * For services: Punjab, Sindh, Khyber Pakhtunkhwa (`KP`, `KPK`),
26
+ * Balochistan or Islamabad Capital Territory (`ICT`, `Islamabad`). For
27
+ * goods it may be left out; Azad Jammu and Kashmir and Gilgit-Baltistan
28
+ * return `null`.
29
+ */
30
+ province?: string;
31
+ /** `YYYY-MM-DD` or a `Date` (its local calendar date). Defaults to today. */
32
+ date?: string | Date;
33
+ }
34
+ /** Result of {@link calculateSalesTax} and {@link splitInclusive}. */
35
+ interface SalesTaxAmounts {
36
+ /** Value excluding tax, in rupees (2 decimals at most). */
37
+ net: number;
38
+ tax: number;
39
+ /** Value including tax. */
40
+ gross: number;
41
+ /** Percent used. */
42
+ rate: number;
43
+ }
44
+ /** Options for {@link calculateSalesTax}: a `rate`, or a `province`/`kind` to look one up. */
45
+ interface SalesTaxOptions {
46
+ /** Percent, 0 to 100, at most 2 decimals. Takes precedence over `province`. */
47
+ rate?: number;
48
+ province?: string;
49
+ /** Defaults to `services` when a province is given. */
50
+ kind?: SalesTaxKind;
51
+ date?: string | Date;
52
+ /** `true` if `amount` already includes the tax. */
53
+ inclusive?: boolean;
54
+ }
55
+ /**
56
+ * Returns the standard sales tax rate for goods (federal, Sales Tax Act
57
+ * 1990) or for services in a province or Islamabad Capital Territory, on a
58
+ * given date.
59
+ *
60
+ * Only standard rates are covered, from 1 July 2019. Reduced, higher and
61
+ * sector rates (telecom, restaurants paid by card, Third Schedule goods and
62
+ * so on) are not. Every rate comes from the authority's own Act or Finance
63
+ * Act; see DATA.md.
64
+ *
65
+ * @returns The rate and its source, or `null` for an unknown province or
66
+ * kind, an invalid date, or a date before 1 July 2019. Never throws.
67
+ *
68
+ * @example
69
+ * getSalesTaxRate({ kind: 'goods', date: '2026-11-18' })?.rate; // 18
70
+ * getSalesTaxRate({ kind: 'services', province: 'Sindh', date: '2024-06-30' })?.rate; // 13
71
+ */
72
+ declare function getSalesTaxRate(query: SalesTaxRateQuery): SalesTaxRate | null;
73
+ /**
74
+ * Splits an amount that includes sales tax into its value and tax.
75
+ *
76
+ * The value is rounded half up to the paisa, and the tax is the rest, so
77
+ * `net + tax` is always `gross`.
78
+ *
79
+ * @param gross - Amount including tax, 0 to 1 trillion rupees
80
+ * @param rate - Percent, 0 to 100, at most 2 decimals
81
+ * @returns The split, or `null` for an invalid amount or rate. Never throws.
82
+ *
83
+ * @example
84
+ * splitInclusive(1180, 18); // { net: 1000, tax: 180, gross: 1180, rate: 18 }
85
+ */
86
+ declare function splitInclusive(gross: number, rate: number): SalesTaxAmounts | null;
87
+ /**
88
+ * Adds sales tax to an amount, or splits it out when `inclusive` is set.
89
+ *
90
+ * Give a `rate`, or a `province` (and `kind`, default `services`, and
91
+ * `date`) to use the standard rate from {@link getSalesTaxRate}. The tax is
92
+ * rounded half up to the paisa.
93
+ *
94
+ * @param amount - 0 to 1 trillion rupees
95
+ * @returns The amounts, or `null` if the amount, rate or province is
96
+ * invalid or no rate applies. Never throws.
97
+ *
98
+ * @example
99
+ * calculateSalesTax(1000, { rate: 18 }); // { net: 1000, tax: 180, gross: 1180, rate: 18 }
100
+ * calculateSalesTax(1000, { province: 'Punjab', date: '2026-11-18' }); // { net: 1000, tax: 160, gross: 1160, rate: 16 }
101
+ * calculateSalesTax(1150, { province: 'Sindh', date: '2026-11-18', inclusive: true }); // { net: 1000, tax: 150, gross: 1150, rate: 15 }
102
+ */
103
+ declare function calculateSalesTax(amount: number, options: SalesTaxOptions): SalesTaxAmounts | null;
104
+
105
+ export { calculateSalesTax, getSalesTaxRate, splitInclusive };
106
+ export type { SalesTaxAmounts, SalesTaxKind, SalesTaxOptions, SalesTaxRate, SalesTaxRateQuery };
@@ -0,0 +1,3 @@
1
+ export { calculateSalesTax, getSalesTaxRate, splitInclusive } from './chunk-34U2ZMHR.js';
2
+ import './chunk-5EY5DQS7.js';
3
+ import './chunk-ENQ7O7VW.js';
@@ -1,20 +1,25 @@
1
1
  'use strict';
2
2
 
3
- var chunkTBTWZC74_cjs = require('./chunk-TBTWZC74.cjs');
4
- require('./chunk-SQIHFEXI.cjs');
5
- require('./chunk-AUQFA7EE.cjs');
6
- require('./chunk-7E7L3NYS.cjs');
3
+ var chunkXCFZKCV2_cjs = require('./chunk-XCFZKCV2.cjs');
7
4
  require('./chunk-ESKXG7Y6.cjs');
5
+ require('./chunk-YDUXIENX.cjs');
6
+ require('./chunk-H6M6L26S.cjs');
7
+ require('./chunk-SQIHFEXI.cjs');
8
+ require('./chunk-DHOP7LQX.cjs');
8
9
  require('./chunk-MTS6SVNP.cjs');
10
+ require('./chunk-AUQFA7EE.cjs');
9
11
  require('./chunk-YTLE5K7G.cjs');
10
- require('./chunk-H6M6L26S.cjs');
12
+ require('./chunk-7E7L3NYS.cjs');
13
+ require('./chunk-QFPEFD67.cjs');
14
+ require('./chunk-I7UUPD3G.cjs');
11
15
  require('./chunk-HTCSHHOR.cjs');
12
- require('./chunk-DHOP7LQX.cjs');
16
+ require('./chunk-33GOK7EE.cjs');
17
+ require('./chunk-E6GWBOKV.cjs');
13
18
  require('./chunk-VPBMIYO2.cjs');
14
19
  var superstruct = require('superstruct');
15
20
 
16
21
  function schema(name) {
17
- const rule = chunkTBTWZC74_cjs.RULES[name];
22
+ const rule = chunkXCFZKCV2_cjs.RULES[name];
18
23
  return (options = {}) => superstruct.refine(
19
24
  superstruct.string(),
20
25
  `pk-${name}`,
@@ -29,7 +34,8 @@ var pk = {
29
34
  strn: schema("strn"),
30
35
  landline: schema("landline"),
31
36
  passport: schema("passport"),
32
- vehiclePlate: schema("vehiclePlate")
37
+ vehiclePlate: schema("vehiclePlate"),
38
+ codPhone: schema("codPhone")
33
39
  };
34
40
 
35
41
  exports.pk = pk;
@@ -19,6 +19,7 @@ declare const pk: {
19
19
  landline: (options?: AdapterOptions) => superstruct.Struct<string, null>;
20
20
  passport: (options?: AdapterOptions) => superstruct.Struct<string, null>;
21
21
  vehiclePlate: (options?: AdapterOptions) => superstruct.Struct<string, null>;
22
+ codPhone: (options?: AdapterOptions) => superstruct.Struct<string, null>;
22
23
  };
23
24
 
24
25
  export { AdapterOptions, pk };
@@ -19,6 +19,7 @@ declare const pk: {
19
19
  landline: (options?: AdapterOptions) => superstruct.Struct<string, null>;
20
20
  passport: (options?: AdapterOptions) => superstruct.Struct<string, null>;
21
21
  vehiclePlate: (options?: AdapterOptions) => superstruct.Struct<string, null>;
22
+ codPhone: (options?: AdapterOptions) => superstruct.Struct<string, null>;
22
23
  };
23
24
 
24
25
  export { AdapterOptions, pk };
@@ -1,13 +1,18 @@
1
- import { RULES } from './chunk-YTSMFGTW.js';
2
- import './chunk-RZQJAZKC.js';
3
- import './chunk-LQHM3ADX.js';
4
- import './chunk-E6HSKRAE.js';
1
+ import { RULES } from './chunk-IDTRFOQW.js';
5
2
  import './chunk-S274QFFB.js';
3
+ import './chunk-UYFTXD4P.js';
4
+ import './chunk-CEPNSHIC.js';
5
+ import './chunk-RZQJAZKC.js';
6
+ import './chunk-IBZPJS4H.js';
6
7
  import './chunk-V2XE3NCG.js';
8
+ import './chunk-LQHM3ADX.js';
7
9
  import './chunk-P7LVE2TF.js';
8
- import './chunk-CEPNSHIC.js';
10
+ import './chunk-E6HSKRAE.js';
11
+ import './chunk-B7DOQ5QF.js';
12
+ import './chunk-33QMFE2Z.js';
9
13
  import './chunk-EEVNLTB4.js';
10
- import './chunk-IBZPJS4H.js';
14
+ import './chunk-XOTCIXY6.js';
15
+ import './chunk-E2XU6NOW.js';
11
16
  import './chunk-ENQ7O7VW.js';
12
17
  import { refine, string } from 'superstruct';
13
18
 
@@ -27,7 +32,8 @@ var pk = {
27
32
  strn: schema("strn"),
28
33
  landline: schema("landline"),
29
34
  passport: schema("passport"),
30
- vehiclePlate: schema("vehiclePlate")
35
+ vehiclePlate: schema("vehiclePlate"),
36
+ codPhone: schema("codPhone")
31
37
  };
32
38
 
33
39
  export { pk };
package/dist/text.cjs CHANGED
@@ -1,23 +1,39 @@
1
1
  'use strict';
2
2
 
3
- var chunkKEHCTYLO_cjs = require('./chunk-KEHCTYLO.cjs');
3
+ var chunkXVEG53NN_cjs = require('./chunk-XVEG53NN.cjs');
4
4
  require('./chunk-VPBMIYO2.cjs');
5
5
 
6
6
 
7
7
 
8
+ Object.defineProperty(exports, "compareUrdu", {
9
+ enumerable: true,
10
+ get: function () { return chunkXVEG53NN_cjs.compareUrdu; }
11
+ });
12
+ Object.defineProperty(exports, "isRTL", {
13
+ enumerable: true,
14
+ get: function () { return chunkXVEG53NN_cjs.isRTL; }
15
+ });
8
16
  Object.defineProperty(exports, "normalizeRomanUrdu", {
9
17
  enumerable: true,
10
- get: function () { return chunkKEHCTYLO_cjs.normalizeRomanUrdu; }
18
+ get: function () { return chunkXVEG53NN_cjs.normalizeRomanUrdu; }
11
19
  });
12
20
  Object.defineProperty(exports, "normalizeText", {
13
21
  enumerable: true,
14
- get: function () { return chunkKEHCTYLO_cjs.normalizeText; }
22
+ get: function () { return chunkXVEG53NN_cjs.normalizeText; }
23
+ });
24
+ Object.defineProperty(exports, "slugify", {
25
+ enumerable: true,
26
+ get: function () { return chunkXVEG53NN_cjs.slugify; }
15
27
  });
16
28
  Object.defineProperty(exports, "toEnglishDigits", {
17
29
  enumerable: true,
18
- get: function () { return chunkKEHCTYLO_cjs.toEnglishDigits; }
30
+ get: function () { return chunkXVEG53NN_cjs.toEnglishDigits; }
19
31
  });
20
32
  Object.defineProperty(exports, "toUrduDigits", {
21
33
  enumerable: true,
22
- get: function () { return chunkKEHCTYLO_cjs.toUrduDigits; }
34
+ get: function () { return chunkXVEG53NN_cjs.toUrduDigits; }
35
+ });
36
+ Object.defineProperty(exports, "wrapBidi", {
37
+ enumerable: true,
38
+ get: function () { return chunkXVEG53NN_cjs.wrapBidi; }
23
39
  });