pakdatakit 2.5.1 → 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.
Files changed (92) hide show
  1. package/DATA.md +83 -7
  2. package/README.md +94 -31
  3. package/dist/{chunk-LQHM3ADX.js → chunk-33JPVN33.js} +11 -6
  4. package/dist/{chunk-XCFZKCV2.cjs → chunk-36K225SE.cjs} +14 -9
  5. package/dist/{chunk-CEPNSHIC.js → chunk-3OCMTNQ7.js} +1 -1
  6. package/dist/{chunk-YDUXIENX.cjs → chunk-4YLSPXBZ.cjs} +2 -2
  7. package/dist/{chunk-2OBKPYJZ.cjs → chunk-6AIN4FKB.cjs} +12 -4
  8. package/dist/chunk-7NTUEHQV.cjs +69 -0
  9. package/dist/{chunk-KRYHLYN2.js → chunk-BATPA7GN.js} +12 -4
  10. package/dist/chunk-CKCOK6X4.js +64 -0
  11. package/dist/{chunk-7DY26QPN.js → chunk-CRYCAMWC.js} +1 -1
  12. package/dist/{chunk-TVL6RDAU.cjs → chunk-EGF4CINK.cjs} +2 -2
  13. package/dist/{chunk-XVEG53NN.cjs → chunk-GOGEMCGG.cjs} +84 -0
  14. package/dist/chunk-NDW52ZK3.js +85 -0
  15. package/dist/chunk-NLSIAPZG.cjs +90 -0
  16. package/dist/{chunk-IDTRFOQW.js → chunk-OYQJQE5R.js} +10 -5
  17. package/dist/{chunk-5RGX4DWF.js → chunk-SGGQ6XB2.js} +46 -14
  18. package/dist/{chunk-UYFTXD4P.js → chunk-T6K46DGW.js} +1 -1
  19. package/dist/{chunk-AUQFA7EE.cjs → chunk-VSIVT5RT.cjs} +11 -6
  20. package/dist/{chunk-H6M6L26S.cjs → chunk-VZIBHQC7.cjs} +2 -2
  21. package/dist/{chunk-EA3SIHYT.js → chunk-WYNM5ZWY.js} +84 -1
  22. package/dist/{chunk-5DDHO5Z7.cjs → chunk-XWGSREI5.cjs} +46 -14
  23. package/dist/class-validator.cjs +18 -9
  24. package/dist/class-validator.d.cts +12 -3
  25. package/dist/class-validator.d.ts +12 -3
  26. package/dist/class-validator.js +17 -9
  27. package/dist/cli.js +1 -1
  28. package/dist/cnic.cjs +11 -3
  29. package/dist/cnic.d.cts +80 -3
  30. package/dist/cnic.d.ts +80 -3
  31. package/dist/cnic.js +1 -1
  32. package/dist/format.cjs +11 -3
  33. package/dist/format.d.cts +57 -1
  34. package/dist/format.d.ts +57 -1
  35. package/dist/format.js +1 -1
  36. package/dist/incometax.cjs +6 -6
  37. package/dist/incometax.d.cts +51 -7
  38. package/dist/incometax.d.ts +51 -7
  39. package/dist/incometax.js +1 -1
  40. package/dist/index.cjs +67 -47
  41. package/dist/index.d.cts +5 -5
  42. package/dist/index.d.ts +5 -5
  43. package/dist/index.js +10 -10
  44. package/dist/input.cjs +8 -8
  45. package/dist/input.js +2 -2
  46. package/dist/joi.cjs +10 -8
  47. package/dist/joi.d.cts +2 -1
  48. package/dist/joi.d.ts +2 -1
  49. package/dist/joi.js +9 -7
  50. package/dist/numbers.cjs +5 -5
  51. package/dist/numbers.d.cts +28 -5
  52. package/dist/numbers.d.ts +28 -5
  53. package/dist/numbers.js +1 -1
  54. package/dist/quality.cjs +5 -5
  55. package/dist/quality.js +2 -2
  56. package/dist/raast.cjs +5 -5
  57. package/dist/raast.d.cts +17 -6
  58. package/dist/raast.d.ts +17 -6
  59. package/dist/raast.js +1 -1
  60. package/dist/{rules-GxgPiVws.d.cts → rules-GEELAOfb.d.cts} +5 -0
  61. package/dist/{rules-GxgPiVws.d.ts → rules-GEELAOfb.d.ts} +5 -0
  62. package/dist/superstruct.cjs +10 -8
  63. package/dist/superstruct.d.cts +2 -1
  64. package/dist/superstruct.d.ts +2 -1
  65. package/dist/superstruct.js +9 -7
  66. package/dist/tax.cjs +5 -5
  67. package/dist/tax.d.cts +8 -2
  68. package/dist/tax.d.ts +8 -2
  69. package/dist/tax.js +2 -2
  70. package/dist/text.cjs +13 -9
  71. package/dist/text.d.cts +40 -4
  72. package/dist/text.d.ts +40 -4
  73. package/dist/text.js +1 -1
  74. package/dist/valibot.cjs +16 -8
  75. package/dist/valibot.d.cts +2 -1
  76. package/dist/valibot.d.ts +2 -1
  77. package/dist/valibot.js +15 -7
  78. package/dist/words.d.cts +4 -1
  79. package/dist/words.d.ts +4 -1
  80. package/dist/yup.cjs +10 -8
  81. package/dist/yup.d.cts +2 -1
  82. package/dist/yup.d.ts +2 -1
  83. package/dist/yup.js +9 -7
  84. package/dist/zod.cjs +12 -8
  85. package/dist/zod.d.cts +2 -1
  86. package/dist/zod.d.ts +2 -1
  87. package/dist/zod.js +11 -7
  88. package/package.json +2 -2
  89. package/dist/chunk-6TSKA2PH.js +0 -38
  90. package/dist/chunk-EEVNLTB4.js +0 -32
  91. package/dist/chunk-HTCSHHOR.cjs +0 -35
  92. package/dist/chunk-LVHTH4P7.cjs +0 -41
package/dist/numbers.d.ts CHANGED
@@ -1,4 +1,8 @@
1
- /** Kind of Pakistani telephone number. */
1
+ /**
2
+ * Kind of Pakistani telephone number. `'personal'` is never returned since
3
+ * 2.7.0 (0122 numbers have no PTA source; see DATA.md); it stays in the type
4
+ * so existing code compiles, and will be removed in 3.0.
5
+ */
2
6
  type NumberType = 'mobile' | 'landline' | 'uan' | 'toll-free' | 'premium' | 'personal';
3
7
  /** Result of {@link analyzeNumber}. */
4
8
  interface NumberInfo {
@@ -14,7 +18,8 @@ interface NumberInfo {
14
18
  }
15
19
  /**
16
20
  * Identifies and formats any Pakistani telephone number: mobile, landline,
17
- * UAN (`111`), toll-free (`0800`), premium-rate (`0900`) or personal (`0122`).
21
+ * UAN (`111`), toll-free (`0800`) or premium-rate (`0900`). 0122 numbers are
22
+ * not recognised: no PTA document lists them (see DATA.md).
18
23
  *
19
24
  * @example
20
25
  * analyzeNumber('021-111-825-888');
@@ -35,13 +40,31 @@ declare function analyzeNumber(phone: string): NumberInfo | null;
35
40
  * @returns Number type, or `null` if it is not a valid Pakistani number
36
41
  */
37
42
  declare function getNumberType(phone: string): NumberType | null;
43
+ /** Options for {@link validateLandline}. */
44
+ interface LandlineOptions {
45
+ /**
46
+ * Also accept the non-geographic service numbers a business may give as
47
+ * its landline: UAN (`021-111-123-456`, `111-123-456`), toll-free
48
+ * (`0800-12345`) and premium rate (`0900-12345`). Default `false`.
49
+ */
50
+ services?: boolean;
51
+ }
38
52
  /**
39
53
  * Validates a Pakistani landline (fixed-line) number such as `042-35761234`.
54
+ * With `{ services: true }` it also accepts UAN, toll-free and premium-rate
55
+ * numbers; {@link analyzeNumber} tells them apart with its `type` field.
56
+ *
57
+ * @example
58
+ * validateLandline('042-35761234'); // true
59
+ * validateLandline('021-111-123-456'); // false
60
+ * validateLandline('021-111-123-456', { services: true }); // true
40
61
  *
41
62
  * @param phone - Number in local or international format
42
- * @returns `true` for a valid landline number
63
+ * @param options - `services: true` to accept UAN, toll-free and premium numbers
64
+ * @returns `true` for a valid landline number (or service number, with
65
+ * `services`). Never throws.
43
66
  */
44
- declare function validateLandline(phone: string): boolean;
67
+ declare function validateLandline(phone: string, options?: LandlineOptions): boolean;
45
68
  /**
46
69
  * Returns the landline area code for a city, with trunk prefix (e.g. `"042"`).
47
70
  *
@@ -51,4 +74,4 @@ declare function validateLandline(phone: string): boolean;
51
74
  declare function getAreaCode(city: string): string | null;
52
75
 
53
76
  export { analyzeNumber, getAreaCode, getNumberType, validateLandline };
54
- export type { NumberInfo, NumberType };
77
+ export type { LandlineOptions, NumberInfo, NumberType };
package/dist/numbers.js CHANGED
@@ -1,3 +1,3 @@
1
- export { analyzeNumber, getAreaCode, getNumberType, validateLandline } from './chunk-LQHM3ADX.js';
1
+ export { analyzeNumber, getAreaCode, getNumberType, validateLandline } from './chunk-33JPVN33.js';
2
2
  import './chunk-P7LVE2TF.js';
3
3
  import './chunk-ENQ7O7VW.js';
package/dist/quality.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkYDUXIENX_cjs = require('./chunk-YDUXIENX.cjs');
4
- require('./chunk-AUQFA7EE.cjs');
3
+ var chunk4YLSPXBZ_cjs = require('./chunk-4YLSPXBZ.cjs');
4
+ require('./chunk-VSIVT5RT.cjs');
5
5
  require('./chunk-YTLE5K7G.cjs');
6
6
  require('./chunk-QFPEFD67.cjs');
7
7
  require('./chunk-I7UUPD3G.cjs');
@@ -13,13 +13,13 @@ require('./chunk-VPBMIYO2.cjs');
13
13
 
14
14
  Object.defineProperty(exports, "ADDRESS_WEIGHTS", {
15
15
  enumerable: true,
16
- get: function () { return chunkYDUXIENX_cjs.ADDRESS_WEIGHTS; }
16
+ get: function () { return chunk4YLSPXBZ_cjs.ADDRESS_WEIGHTS; }
17
17
  });
18
18
  Object.defineProperty(exports, "phoneRiskSignals", {
19
19
  enumerable: true,
20
- get: function () { return chunkYDUXIENX_cjs.phoneRiskSignals; }
20
+ get: function () { return chunk4YLSPXBZ_cjs.phoneRiskSignals; }
21
21
  });
22
22
  Object.defineProperty(exports, "scoreAddress", {
23
23
  enumerable: true,
24
- get: function () { return chunkYDUXIENX_cjs.scoreAddress; }
24
+ get: function () { return chunk4YLSPXBZ_cjs.scoreAddress; }
25
25
  });
package/dist/quality.js CHANGED
@@ -1,5 +1,5 @@
1
- export { ADDRESS_WEIGHTS, phoneRiskSignals, scoreAddress } from './chunk-UYFTXD4P.js';
2
- import './chunk-LQHM3ADX.js';
1
+ export { ADDRESS_WEIGHTS, phoneRiskSignals, scoreAddress } from './chunk-T6K46DGW.js';
2
+ import './chunk-33JPVN33.js';
3
3
  import './chunk-P7LVE2TF.js';
4
4
  import './chunk-B7DOQ5QF.js';
5
5
  import './chunk-33QMFE2Z.js';
package/dist/raast.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk2OBKPYJZ_cjs = require('./chunk-2OBKPYJZ.cjs');
3
+ var chunk6AIN4FKB_cjs = require('./chunk-6AIN4FKB.cjs');
4
4
  require('./chunk-DHOP7LQX.cjs');
5
5
  require('./chunk-VPBMIYO2.cjs');
6
6
 
@@ -8,17 +8,17 @@ require('./chunk-VPBMIYO2.cjs');
8
8
 
9
9
  Object.defineProperty(exports, "createMerchantQr", {
10
10
  enumerable: true,
11
- get: function () { return chunk2OBKPYJZ_cjs.createMerchantQr; }
11
+ get: function () { return chunk6AIN4FKB_cjs.createMerchantQr; }
12
12
  });
13
13
  Object.defineProperty(exports, "createRaastP2PQr", {
14
14
  enumerable: true,
15
- get: function () { return chunk2OBKPYJZ_cjs.createRaastP2PQr; }
15
+ get: function () { return chunk6AIN4FKB_cjs.createRaastP2PQr; }
16
16
  });
17
17
  Object.defineProperty(exports, "parseRaastQr", {
18
18
  enumerable: true,
19
- get: function () { return chunk2OBKPYJZ_cjs.parseRaastQr; }
19
+ get: function () { return chunk6AIN4FKB_cjs.parseRaastQr; }
20
20
  });
21
21
  Object.defineProperty(exports, "validateRaastQr", {
22
22
  enumerable: true,
23
- get: function () { return chunk2OBKPYJZ_cjs.validateRaastQr; }
23
+ get: function () { return chunk6AIN4FKB_cjs.validateRaastQr; }
24
24
  });
package/dist/raast.d.cts CHANGED
@@ -147,12 +147,21 @@ declare function createMerchantQr(options: MerchantQrOptions): string;
147
147
  declare function parseRaastQr(payload: string): ParsedRaastQr | null;
148
148
  /** A problem that stops a Raast QR from working or makes it unsafe to pay. */
149
149
  type RaastQrError = 'not-a-raast-qr' | 'bad-checksum' | 'no-iban' | 'invalid-iban' | 'expired' | 'missing-expiry';
150
- /** Something worth telling the payer, but which does not stop payment. */
151
- type RaastQrWarning = 'amount-ignored' | 'expires-soon';
150
+ /**
151
+ * Something worth telling the payer, but which does not stop payment.
152
+ * `no-iban`: a merchant QR that names no IBAN; it pays through the
153
+ * merchant's own scheme, so the payee can't be checked from the QR.
154
+ */
155
+ type RaastQrWarning = 'amount-ignored' | 'expires-soon' | 'no-iban';
152
156
  /** Result of {@link validateRaastQr}. */
153
157
  interface RaastQrValidation {
154
158
  /** `true` when there are no errors. */
155
159
  valid: boolean;
160
+ /**
161
+ * `p2p` for a person-to-person QR, `merchant` for a merchant QR, `null`
162
+ * when the text is not a Raast QR.
163
+ */
164
+ kind: 'p2p' | 'merchant' | null;
156
165
  errors: RaastQrError[];
157
166
  warnings: RaastQrWarning[];
158
167
  /** The parsed QR, or `null` if it could not be read. */
@@ -170,14 +179,16 @@ interface ValidateRaastQrOptions {
170
179
  * screen or to warn about a tampered sticker.
171
180
  *
172
181
  * Errors: not a Pakistani payment QR, checksum mismatch (damaged or edited),
173
- * no IBAN or an IBAN that fails its checksum, expired, or a fixed-amount QR
174
- * without the expiry that banking apps require.
182
+ * a person-to-person QR with no IBAN, an IBAN that fails its checksum,
183
+ * expired, or a fixed-amount QR without the expiry that banking apps require.
175
184
  * Warnings: an amount in a static QR (apps ignore it, so the payer must type
176
- * it), or a QR that expires soon (within an hour by default).
185
+ * it), a QR that expires soon (within an hour by default), or a merchant QR
186
+ * with no IBAN (`no-iban`): merchant QRs may pay through the merchant's own
187
+ * scheme, so it is valid, but the payee can't be checked from the QR.
177
188
  *
178
189
  * @example
179
190
  * validateRaastQr(scannedText);
180
- * // { valid: false, errors: ['expired'], warnings: [], qr: { ... } }
191
+ * // { valid: false, kind: 'p2p', errors: ['expired'], warnings: [], qr: { ... } }
181
192
  *
182
193
  * @param payload - Text decoded from the QR code
183
194
  * @param options - Time to check against and the "expires soon" window
package/dist/raast.d.ts CHANGED
@@ -147,12 +147,21 @@ declare function createMerchantQr(options: MerchantQrOptions): string;
147
147
  declare function parseRaastQr(payload: string): ParsedRaastQr | null;
148
148
  /** A problem that stops a Raast QR from working or makes it unsafe to pay. */
149
149
  type RaastQrError = 'not-a-raast-qr' | 'bad-checksum' | 'no-iban' | 'invalid-iban' | 'expired' | 'missing-expiry';
150
- /** Something worth telling the payer, but which does not stop payment. */
151
- type RaastQrWarning = 'amount-ignored' | 'expires-soon';
150
+ /**
151
+ * Something worth telling the payer, but which does not stop payment.
152
+ * `no-iban`: a merchant QR that names no IBAN; it pays through the
153
+ * merchant's own scheme, so the payee can't be checked from the QR.
154
+ */
155
+ type RaastQrWarning = 'amount-ignored' | 'expires-soon' | 'no-iban';
152
156
  /** Result of {@link validateRaastQr}. */
153
157
  interface RaastQrValidation {
154
158
  /** `true` when there are no errors. */
155
159
  valid: boolean;
160
+ /**
161
+ * `p2p` for a person-to-person QR, `merchant` for a merchant QR, `null`
162
+ * when the text is not a Raast QR.
163
+ */
164
+ kind: 'p2p' | 'merchant' | null;
156
165
  errors: RaastQrError[];
157
166
  warnings: RaastQrWarning[];
158
167
  /** The parsed QR, or `null` if it could not be read. */
@@ -170,14 +179,16 @@ interface ValidateRaastQrOptions {
170
179
  * screen or to warn about a tampered sticker.
171
180
  *
172
181
  * Errors: not a Pakistani payment QR, checksum mismatch (damaged or edited),
173
- * no IBAN or an IBAN that fails its checksum, expired, or a fixed-amount QR
174
- * without the expiry that banking apps require.
182
+ * a person-to-person QR with no IBAN, an IBAN that fails its checksum,
183
+ * expired, or a fixed-amount QR without the expiry that banking apps require.
175
184
  * Warnings: an amount in a static QR (apps ignore it, so the payer must type
176
- * it), or a QR that expires soon (within an hour by default).
185
+ * it), a QR that expires soon (within an hour by default), or a merchant QR
186
+ * with no IBAN (`no-iban`): merchant QRs may pay through the merchant's own
187
+ * scheme, so it is valid, but the payee can't be checked from the QR.
177
188
  *
178
189
  * @example
179
190
  * validateRaastQr(scannedText);
180
- * // { valid: false, errors: ['expired'], warnings: [], qr: { ... } }
191
+ * // { valid: false, kind: 'p2p', errors: ['expired'], warnings: [], qr: { ... } }
181
192
  *
182
193
  * @param payload - Text decoded from the QR code
183
194
  * @param options - Time to check against and the "expires soon" window
package/dist/raast.js CHANGED
@@ -1,3 +1,3 @@
1
- export { createMerchantQr, createRaastP2PQr, parseRaastQr, validateRaastQr } from './chunk-KRYHLYN2.js';
1
+ export { createMerchantQr, createRaastP2PQr, parseRaastQr, validateRaastQr } from './chunk-BATPA7GN.js';
2
2
  import './chunk-IBZPJS4H.js';
3
3
  import './chunk-ENQ7O7VW.js';
@@ -2,6 +2,11 @@
2
2
  interface AdapterOptions {
3
3
  /** Error message to show instead of the default. */
4
4
  message?: string;
5
+ /**
6
+ * `landline()` only: also accept UAN, toll-free and premium-rate numbers
7
+ * (see `validateLandline`). Ignored by the other checks.
8
+ */
9
+ services?: boolean;
5
10
  }
6
11
 
7
12
  export type { AdapterOptions as A };
@@ -2,6 +2,11 @@
2
2
  interface AdapterOptions {
3
3
  /** Error message to show instead of the default. */
4
4
  message?: string;
5
+ /**
6
+ * `landline()` only: also accept UAN, toll-free and premium-rate numbers
7
+ * (see `validateLandline`). Ignored by the other checks.
8
+ */
9
+ services?: boolean;
5
10
  }
6
11
 
7
12
  export type { AdapterOptions as A };
@@ -1,29 +1,30 @@
1
1
  'use strict';
2
2
 
3
- var chunkXCFZKCV2_cjs = require('./chunk-XCFZKCV2.cjs');
3
+ var chunk36K225SE_cjs = require('./chunk-36K225SE.cjs');
4
4
  require('./chunk-ESKXG7Y6.cjs');
5
- require('./chunk-YDUXIENX.cjs');
6
- require('./chunk-H6M6L26S.cjs');
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-AUQFA7EE.cjs');
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-HTCSHHOR.cjs');
15
+ require('./chunk-7NTUEHQV.cjs');
16
+ require('./chunk-NLSIAPZG.cjs');
16
17
  require('./chunk-33GOK7EE.cjs');
17
18
  require('./chunk-E6GWBOKV.cjs');
18
19
  require('./chunk-VPBMIYO2.cjs');
19
20
  var superstruct = require('superstruct');
20
21
 
21
22
  function schema(name) {
22
- const rule = chunkXCFZKCV2_cjs.RULES[name];
23
+ const rule = chunk36K225SE_cjs.RULES[name];
23
24
  return (options = {}) => superstruct.refine(
24
25
  superstruct.string(),
25
26
  `pk-${name}`,
26
- (value) => rule.test(value) || (options.message ?? rule.message)
27
+ (value) => rule.test(value, options) || (options.message ?? rule.message)
27
28
  );
28
29
  }
29
30
  var pk = {
@@ -35,7 +36,8 @@ var pk = {
35
36
  landline: schema("landline"),
36
37
  passport: schema("passport"),
37
38
  vehiclePlate: schema("vehiclePlate"),
38
- codPhone: schema("codPhone")
39
+ codPhone: schema("codPhone"),
40
+ amount: schema("amount")
39
41
  };
40
42
 
41
43
  exports.pk = pk;
@@ -1,5 +1,5 @@
1
1
  import * as superstruct from 'superstruct';
2
- import { A as AdapterOptions } from './rules-GxgPiVws.cjs';
2
+ import { A as AdapterOptions } from './rules-GEELAOfb.cjs';
3
3
 
4
4
  /**
5
5
  * Superstruct structs for Pakistani identifiers.
@@ -20,6 +20,7 @@ declare const pk: {
20
20
  passport: (options?: AdapterOptions) => superstruct.Struct<string, null>;
21
21
  vehiclePlate: (options?: AdapterOptions) => superstruct.Struct<string, null>;
22
22
  codPhone: (options?: AdapterOptions) => superstruct.Struct<string, null>;
23
+ amount: (options?: AdapterOptions) => superstruct.Struct<string, null>;
23
24
  };
24
25
 
25
26
  export { AdapterOptions, pk };
@@ -1,5 +1,5 @@
1
1
  import * as superstruct from 'superstruct';
2
- import { A as AdapterOptions } from './rules-GxgPiVws.js';
2
+ import { A as AdapterOptions } from './rules-GEELAOfb.js';
3
3
 
4
4
  /**
5
5
  * Superstruct structs for Pakistani identifiers.
@@ -20,6 +20,7 @@ declare const pk: {
20
20
  passport: (options?: AdapterOptions) => superstruct.Struct<string, null>;
21
21
  vehiclePlate: (options?: AdapterOptions) => superstruct.Struct<string, null>;
22
22
  codPhone: (options?: AdapterOptions) => superstruct.Struct<string, null>;
23
+ amount: (options?: AdapterOptions) => superstruct.Struct<string, null>;
23
24
  };
24
25
 
25
26
  export { AdapterOptions, pk };
@@ -1,16 +1,17 @@
1
- import { RULES } from './chunk-IDTRFOQW.js';
1
+ import { RULES } from './chunk-OYQJQE5R.js';
2
2
  import './chunk-S274QFFB.js';
3
- import './chunk-UYFTXD4P.js';
4
- import './chunk-CEPNSHIC.js';
3
+ import './chunk-T6K46DGW.js';
4
+ import './chunk-3OCMTNQ7.js';
5
5
  import './chunk-RZQJAZKC.js';
6
6
  import './chunk-IBZPJS4H.js';
7
7
  import './chunk-V2XE3NCG.js';
8
- import './chunk-LQHM3ADX.js';
8
+ import './chunk-33JPVN33.js';
9
9
  import './chunk-P7LVE2TF.js';
10
10
  import './chunk-E6HSKRAE.js';
11
11
  import './chunk-B7DOQ5QF.js';
12
12
  import './chunk-33QMFE2Z.js';
13
- import './chunk-EEVNLTB4.js';
13
+ import './chunk-CKCOK6X4.js';
14
+ import './chunk-NDW52ZK3.js';
14
15
  import './chunk-XOTCIXY6.js';
15
16
  import './chunk-E2XU6NOW.js';
16
17
  import './chunk-ENQ7O7VW.js';
@@ -21,7 +22,7 @@ function schema(name) {
21
22
  return (options = {}) => refine(
22
23
  string(),
23
24
  `pk-${name}`,
24
- (value) => rule.test(value) || (options.message ?? rule.message)
25
+ (value) => rule.test(value, options) || (options.message ?? rule.message)
25
26
  );
26
27
  }
27
28
  var pk = {
@@ -33,7 +34,8 @@ var pk = {
33
34
  landline: schema("landline"),
34
35
  passport: schema("passport"),
35
36
  vehiclePlate: schema("vehiclePlate"),
36
- codPhone: schema("codPhone")
37
+ codPhone: schema("codPhone"),
38
+ amount: schema("amount")
37
39
  };
38
40
 
39
41
  export { pk };
package/dist/tax.cjs CHANGED
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var chunkH6M6L26S_cjs = require('./chunk-H6M6L26S.cjs');
4
- require('./chunk-HTCSHHOR.cjs');
3
+ var chunkVZIBHQC7_cjs = require('./chunk-VZIBHQC7.cjs');
4
+ require('./chunk-7NTUEHQV.cjs');
5
5
  require('./chunk-VPBMIYO2.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "analyzeNTN", {
10
10
  enumerable: true,
11
- get: function () { return chunkH6M6L26S_cjs.analyzeNTN; }
11
+ get: function () { return chunkVZIBHQC7_cjs.analyzeNTN; }
12
12
  });
13
13
  Object.defineProperty(exports, "validateNTN", {
14
14
  enumerable: true,
15
- get: function () { return chunkH6M6L26S_cjs.validateNTN; }
15
+ get: function () { return chunkVZIBHQC7_cjs.validateNTN; }
16
16
  });
17
17
  Object.defineProperty(exports, "validateSTRN", {
18
18
  enumerable: true,
19
- get: function () { return chunkH6M6L26S_cjs.validateSTRN; }
19
+ get: function () { return chunkVZIBHQC7_cjs.validateSTRN; }
20
20
  });
package/dist/tax.d.cts CHANGED
@@ -1,6 +1,12 @@
1
- /** Kind of taxpayer an NTN belongs to. */
1
+ /**
2
+ * Kind of taxpayer an NTN belongs to: `individual` when the NTN is a 13-digit
3
+ * CNIC, `business` for a company's or association's 7-digit NTN.
4
+ */
2
5
  type NTNType = 'individual' | 'business';
3
- /** Result of {@link analyzeNTN}. */
6
+ /**
7
+ * What {@link analyzeNTN} reads from a National Tax Number: the kind of
8
+ * taxpayer, the digits and the usual display form.
9
+ */
4
10
  interface NTNInfo {
5
11
  /** `individual` when the NTN is a CNIC; `business` for a 7-digit company/AOP NTN. */
6
12
  type: NTNType;
package/dist/tax.d.ts CHANGED
@@ -1,6 +1,12 @@
1
- /** Kind of taxpayer an NTN belongs to. */
1
+ /**
2
+ * Kind of taxpayer an NTN belongs to: `individual` when the NTN is a 13-digit
3
+ * CNIC, `business` for a company's or association's 7-digit NTN.
4
+ */
2
5
  type NTNType = 'individual' | 'business';
3
- /** Result of {@link analyzeNTN}. */
6
+ /**
7
+ * What {@link analyzeNTN} reads from a National Tax Number: the kind of
8
+ * taxpayer, the digits and the usual display form.
9
+ */
4
10
  interface NTNInfo {
5
11
  /** `individual` when the NTN is a CNIC; `business` for a 7-digit company/AOP NTN. */
6
12
  type: NTNType;
package/dist/tax.js CHANGED
@@ -1,3 +1,3 @@
1
- export { analyzeNTN, validateNTN, validateSTRN } from './chunk-CEPNSHIC.js';
2
- import './chunk-EEVNLTB4.js';
1
+ export { analyzeNTN, validateNTN, validateSTRN } from './chunk-3OCMTNQ7.js';
2
+ import './chunk-CKCOK6X4.js';
3
3
  import './chunk-ENQ7O7VW.js';
package/dist/text.cjs CHANGED
@@ -1,39 +1,43 @@
1
1
  'use strict';
2
2
 
3
- var chunkXVEG53NN_cjs = require('./chunk-XVEG53NN.cjs');
3
+ var chunkGOGEMCGG_cjs = require('./chunk-GOGEMCGG.cjs');
4
4
  require('./chunk-VPBMIYO2.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "compareUrdu", {
9
9
  enumerable: true,
10
- get: function () { return chunkXVEG53NN_cjs.compareUrdu; }
10
+ get: function () { return chunkGOGEMCGG_cjs.compareUrdu; }
11
11
  });
12
12
  Object.defineProperty(exports, "isRTL", {
13
13
  enumerable: true,
14
- get: function () { return chunkXVEG53NN_cjs.isRTL; }
14
+ get: function () { return chunkGOGEMCGG_cjs.isRTL; }
15
15
  });
16
16
  Object.defineProperty(exports, "normalizeRomanUrdu", {
17
17
  enumerable: true,
18
- get: function () { return chunkXVEG53NN_cjs.normalizeRomanUrdu; }
18
+ get: function () { return chunkGOGEMCGG_cjs.normalizeRomanUrdu; }
19
19
  });
20
20
  Object.defineProperty(exports, "normalizeText", {
21
21
  enumerable: true,
22
- get: function () { return chunkXVEG53NN_cjs.normalizeText; }
22
+ get: function () { return chunkGOGEMCGG_cjs.normalizeText; }
23
+ });
24
+ Object.defineProperty(exports, "romanUrduKey", {
25
+ enumerable: true,
26
+ get: function () { return chunkGOGEMCGG_cjs.romanUrduKey; }
23
27
  });
24
28
  Object.defineProperty(exports, "slugify", {
25
29
  enumerable: true,
26
- get: function () { return chunkXVEG53NN_cjs.slugify; }
30
+ get: function () { return chunkGOGEMCGG_cjs.slugify; }
27
31
  });
28
32
  Object.defineProperty(exports, "toEnglishDigits", {
29
33
  enumerable: true,
30
- get: function () { return chunkXVEG53NN_cjs.toEnglishDigits; }
34
+ get: function () { return chunkGOGEMCGG_cjs.toEnglishDigits; }
31
35
  });
32
36
  Object.defineProperty(exports, "toUrduDigits", {
33
37
  enumerable: true,
34
- get: function () { return chunkXVEG53NN_cjs.toUrduDigits; }
38
+ get: function () { return chunkGOGEMCGG_cjs.toUrduDigits; }
35
39
  });
36
40
  Object.defineProperty(exports, "wrapBidi", {
37
41
  enumerable: true,
38
- get: function () { return chunkXVEG53NN_cjs.wrapBidi; }
42
+ get: function () { return chunkGOGEMCGG_cjs.wrapBidi; }
39
43
  });
package/dist/text.d.cts CHANGED
@@ -30,9 +30,15 @@ declare function toUrduDigits(text: string): string;
30
30
  * @returns Text with English digits
31
31
  */
32
32
  declare function toEnglishDigits(text: string): string;
33
- /** Which letters {@link slugify} keeps. */
33
+ /**
34
+ * Which letters {@link slugify} keeps in a URL slug: `any` (Latin and Urdu),
35
+ * `latin` (a-z only) or `urdu` (Urdu letters only).
36
+ */
34
37
  type SlugScript = 'any' | 'latin' | 'urdu';
35
- /** Options for {@link slugify}. */
38
+ /**
39
+ * Options for {@link slugify}: which script's letters to keep in the slug.
40
+ * Digits are always kept, converted to 0-9.
41
+ */
36
42
  interface SlugifyOptions {
37
43
  /**
38
44
  * `any` (default) keeps Latin and Urdu letters, `latin` keeps only `a-z`,
@@ -100,7 +106,10 @@ declare function compareUrdu(a: string, b: string): -1 | 0 | 1;
100
106
  * Never throws.
101
107
  */
102
108
  declare function isRTL(text: string): boolean;
103
- /** Direction for {@link wrapBidi}. */
109
+ /**
110
+ * Direction for {@link wrapBidi}: `auto` follows the first strong letter,
111
+ * `rtl` and `ltr` force right-to-left or left-to-right.
112
+ */
104
113
  type BidiDirection = 'auto' | 'rtl' | 'ltr';
105
114
  /**
106
115
  * Wraps text in Unicode directional isolates, so a name or number in one
@@ -118,6 +127,33 @@ type BidiDirection = 'auto' | 'rtl' | 'ltr';
118
127
  * throws.
119
128
  */
120
129
  declare function wrapBidi(text: string, direction?: BidiDirection): string;
130
+ /**
131
+ * A phonetic key for Roman Urdu, so that different spellings of the same
132
+ * name or word match: `Mubeen` and `Mobeen`, `Muhammad`, `Mohammad` and
133
+ * `Muhammed`, `Rehman` and `Rahman`, `Chaudhry`, `Chaudhary` and `Chaudhery`.
134
+ * Compare keys, not the text.
135
+ *
136
+ * Each word keeps its consonants, its first vowel sound and a vowel sound at
137
+ * its end. Letters for one sound are merged (`kh`, `sh`, `ch`; `ph` and `f`;
138
+ * `q`, `c` and `k`; `v` and `w`; `th` and `t`, `dh` and `d`), doubled letters
139
+ * count once, `e` counts as `a`, `o` as `u`, and a final `h` after a vowel is
140
+ * dropped. Accents are removed and anything other than Latin letters splits
141
+ * words. The key is not meant to be shown: it is an opaque string.
142
+ *
143
+ * Different names can share a key (`Hamid` and `Hamad`), so treat a match as
144
+ * "probably the same", not proof. {@link normalizeRomanUrdu} is a different
145
+ * tool: it rewrites informal spellings into readable text.
146
+ *
147
+ * @example
148
+ * romanUrduKey('Mubeen') === romanUrduKey('Mobeen'); // true
149
+ * romanUrduKey('Muhammad Rehman'); // 'muhmd rahmn'
150
+ * romanUrduKey('Hussain') === romanUrduKey('Hassan'); // false
151
+ *
152
+ * @param text - A name or other Roman Urdu text
153
+ * @returns The key, one part per word separated by spaces; `''` for text
154
+ * with no Latin letters or a value that is not a string. Never throws.
155
+ */
156
+ declare function romanUrduKey(text: string): string;
121
157
 
122
- export { compareUrdu, isRTL, normalizeRomanUrdu, normalizeText, slugify, toEnglishDigits, toUrduDigits, wrapBidi };
158
+ export { compareUrdu, isRTL, normalizeRomanUrdu, normalizeText, romanUrduKey, slugify, toEnglishDigits, toUrduDigits, wrapBidi };
123
159
  export type { BidiDirection, SlugScript, SlugifyOptions };
package/dist/text.d.ts CHANGED
@@ -30,9 +30,15 @@ declare function toUrduDigits(text: string): string;
30
30
  * @returns Text with English digits
31
31
  */
32
32
  declare function toEnglishDigits(text: string): string;
33
- /** Which letters {@link slugify} keeps. */
33
+ /**
34
+ * Which letters {@link slugify} keeps in a URL slug: `any` (Latin and Urdu),
35
+ * `latin` (a-z only) or `urdu` (Urdu letters only).
36
+ */
34
37
  type SlugScript = 'any' | 'latin' | 'urdu';
35
- /** Options for {@link slugify}. */
38
+ /**
39
+ * Options for {@link slugify}: which script's letters to keep in the slug.
40
+ * Digits are always kept, converted to 0-9.
41
+ */
36
42
  interface SlugifyOptions {
37
43
  /**
38
44
  * `any` (default) keeps Latin and Urdu letters, `latin` keeps only `a-z`,
@@ -100,7 +106,10 @@ declare function compareUrdu(a: string, b: string): -1 | 0 | 1;
100
106
  * Never throws.
101
107
  */
102
108
  declare function isRTL(text: string): boolean;
103
- /** Direction for {@link wrapBidi}. */
109
+ /**
110
+ * Direction for {@link wrapBidi}: `auto` follows the first strong letter,
111
+ * `rtl` and `ltr` force right-to-left or left-to-right.
112
+ */
104
113
  type BidiDirection = 'auto' | 'rtl' | 'ltr';
105
114
  /**
106
115
  * Wraps text in Unicode directional isolates, so a name or number in one
@@ -118,6 +127,33 @@ type BidiDirection = 'auto' | 'rtl' | 'ltr';
118
127
  * throws.
119
128
  */
120
129
  declare function wrapBidi(text: string, direction?: BidiDirection): string;
130
+ /**
131
+ * A phonetic key for Roman Urdu, so that different spellings of the same
132
+ * name or word match: `Mubeen` and `Mobeen`, `Muhammad`, `Mohammad` and
133
+ * `Muhammed`, `Rehman` and `Rahman`, `Chaudhry`, `Chaudhary` and `Chaudhery`.
134
+ * Compare keys, not the text.
135
+ *
136
+ * Each word keeps its consonants, its first vowel sound and a vowel sound at
137
+ * its end. Letters for one sound are merged (`kh`, `sh`, `ch`; `ph` and `f`;
138
+ * `q`, `c` and `k`; `v` and `w`; `th` and `t`, `dh` and `d`), doubled letters
139
+ * count once, `e` counts as `a`, `o` as `u`, and a final `h` after a vowel is
140
+ * dropped. Accents are removed and anything other than Latin letters splits
141
+ * words. The key is not meant to be shown: it is an opaque string.
142
+ *
143
+ * Different names can share a key (`Hamid` and `Hamad`), so treat a match as
144
+ * "probably the same", not proof. {@link normalizeRomanUrdu} is a different
145
+ * tool: it rewrites informal spellings into readable text.
146
+ *
147
+ * @example
148
+ * romanUrduKey('Mubeen') === romanUrduKey('Mobeen'); // true
149
+ * romanUrduKey('Muhammad Rehman'); // 'muhmd rahmn'
150
+ * romanUrduKey('Hussain') === romanUrduKey('Hassan'); // false
151
+ *
152
+ * @param text - A name or other Roman Urdu text
153
+ * @returns The key, one part per word separated by spaces; `''` for text
154
+ * with no Latin letters or a value that is not a string. Never throws.
155
+ */
156
+ declare function romanUrduKey(text: string): string;
121
157
 
122
- export { compareUrdu, isRTL, normalizeRomanUrdu, normalizeText, slugify, toEnglishDigits, toUrduDigits, wrapBidi };
158
+ export { compareUrdu, isRTL, normalizeRomanUrdu, normalizeText, romanUrduKey, slugify, toEnglishDigits, toUrduDigits, wrapBidi };
123
159
  export type { BidiDirection, SlugScript, SlugifyOptions };
package/dist/text.js CHANGED
@@ -1,2 +1,2 @@
1
- export { compareUrdu, isRTL, normalizeRomanUrdu, normalizeText, slugify, toEnglishDigits, toUrduDigits, wrapBidi } from './chunk-EA3SIHYT.js';
1
+ export { compareUrdu, isRTL, normalizeRomanUrdu, normalizeText, romanUrduKey, slugify, toEnglishDigits, toUrduDigits, wrapBidi } from './chunk-WYNM5ZWY.js';
2
2
  import './chunk-ENQ7O7VW.js';