pakdatakit 2.5.0 → 2.6.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/dist/valibot.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkXCFZKCV2_cjs = require('./chunk-XCFZKCV2.cjs');
3
+ var chunkYSRYWZCQ_cjs = require('./chunk-YSRYWZCQ.cjs');
4
4
  require('./chunk-ESKXG7Y6.cjs');
5
5
  require('./chunk-YDUXIENX.cjs');
6
6
  require('./chunk-H6M6L26S.cjs');
@@ -13,6 +13,7 @@ require('./chunk-7E7L3NYS.cjs');
13
13
  require('./chunk-QFPEFD67.cjs');
14
14
  require('./chunk-I7UUPD3G.cjs');
15
15
  require('./chunk-HTCSHHOR.cjs');
16
+ require('./chunk-NLSIAPZG.cjs');
16
17
  require('./chunk-33GOK7EE.cjs');
17
18
  require('./chunk-E6GWBOKV.cjs');
18
19
  require('./chunk-VPBMIYO2.cjs');
@@ -39,7 +40,7 @@ function _interopNamespace(e) {
39
40
  var v__namespace = /*#__PURE__*/_interopNamespace(v);
40
41
 
41
42
  function schema(name) {
42
- const rule = chunkXCFZKCV2_cjs.RULES[name];
43
+ const rule = chunkYSRYWZCQ_cjs.RULES[name];
43
44
  return (options = {}) => v__namespace.pipe(v__namespace.string(), v__namespace.check(rule.test, options.message ?? rule.message));
44
45
  }
45
46
  var pk = {
@@ -51,7 +52,8 @@ var pk = {
51
52
  landline: schema("landline"),
52
53
  passport: schema("passport"),
53
54
  vehiclePlate: schema("vehiclePlate"),
54
- codPhone: schema("codPhone")
55
+ codPhone: schema("codPhone"),
56
+ amount: schema("amount")
55
57
  };
56
58
 
57
59
  exports.pk = pk;
@@ -20,6 +20,7 @@ declare const pk: {
20
20
  passport: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
21
21
  vehiclePlate: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
22
22
  codPhone: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
23
+ amount: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
23
24
  };
24
25
 
25
26
  export { AdapterOptions, pk };
package/dist/valibot.d.ts CHANGED
@@ -20,6 +20,7 @@ declare const pk: {
20
20
  passport: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
21
21
  vehiclePlate: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
22
22
  codPhone: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
23
+ amount: (options?: AdapterOptions) => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, string>]>;
23
24
  };
24
25
 
25
26
  export { AdapterOptions, pk };
package/dist/valibot.js CHANGED
@@ -1,4 +1,4 @@
1
- import { RULES } from './chunk-IDTRFOQW.js';
1
+ import { RULES } from './chunk-QG5T7YQ5.js';
2
2
  import './chunk-S274QFFB.js';
3
3
  import './chunk-UYFTXD4P.js';
4
4
  import './chunk-CEPNSHIC.js';
@@ -11,6 +11,7 @@ import './chunk-E6HSKRAE.js';
11
11
  import './chunk-B7DOQ5QF.js';
12
12
  import './chunk-33QMFE2Z.js';
13
13
  import './chunk-EEVNLTB4.js';
14
+ import './chunk-NDW52ZK3.js';
14
15
  import './chunk-XOTCIXY6.js';
15
16
  import './chunk-E2XU6NOW.js';
16
17
  import './chunk-ENQ7O7VW.js';
@@ -29,7 +30,8 @@ var pk = {
29
30
  landline: schema("landline"),
30
31
  passport: schema("passport"),
31
32
  vehiclePlate: schema("vehiclePlate"),
32
- codPhone: schema("codPhone")
33
+ codPhone: schema("codPhone"),
34
+ amount: schema("amount")
33
35
  };
34
36
 
35
37
  export { pk };
package/dist/yup.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkXCFZKCV2_cjs = require('./chunk-XCFZKCV2.cjs');
3
+ var chunkYSRYWZCQ_cjs = require('./chunk-YSRYWZCQ.cjs');
4
4
  require('./chunk-ESKXG7Y6.cjs');
5
5
  require('./chunk-YDUXIENX.cjs');
6
6
  require('./chunk-H6M6L26S.cjs');
@@ -13,13 +13,14 @@ require('./chunk-7E7L3NYS.cjs');
13
13
  require('./chunk-QFPEFD67.cjs');
14
14
  require('./chunk-I7UUPD3G.cjs');
15
15
  require('./chunk-HTCSHHOR.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 yup = require('yup');
20
21
 
21
22
  function schema(name) {
22
- const rule = chunkXCFZKCV2_cjs.RULES[name];
23
+ const rule = chunkYSRYWZCQ_cjs.RULES[name];
23
24
  return (options = {}) => yup.string().test(
24
25
  `pk-${name}`,
25
26
  options.message ?? rule.message,
@@ -36,7 +37,8 @@ var pk = {
36
37
  landline: schema("landline"),
37
38
  passport: schema("passport"),
38
39
  vehiclePlate: schema("vehiclePlate"),
39
- codPhone: schema("codPhone")
40
+ codPhone: schema("codPhone"),
41
+ amount: schema("amount")
40
42
  };
41
43
 
42
44
  exports.pk = pk;
package/dist/yup.d.cts CHANGED
@@ -20,6 +20,7 @@ declare const pk: {
20
20
  passport: (options?: AdapterOptions) => yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
21
21
  vehiclePlate: (options?: AdapterOptions) => yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
22
22
  codPhone: (options?: AdapterOptions) => yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
23
+ amount: (options?: AdapterOptions) => yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
23
24
  };
24
25
 
25
26
  export { AdapterOptions, pk };
package/dist/yup.d.ts CHANGED
@@ -20,6 +20,7 @@ declare const pk: {
20
20
  passport: (options?: AdapterOptions) => yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
21
21
  vehiclePlate: (options?: AdapterOptions) => yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
22
22
  codPhone: (options?: AdapterOptions) => yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
23
+ amount: (options?: AdapterOptions) => yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
23
24
  };
24
25
 
25
26
  export { AdapterOptions, pk };
package/dist/yup.js CHANGED
@@ -1,4 +1,4 @@
1
- import { RULES } from './chunk-IDTRFOQW.js';
1
+ import { RULES } from './chunk-QG5T7YQ5.js';
2
2
  import './chunk-S274QFFB.js';
3
3
  import './chunk-UYFTXD4P.js';
4
4
  import './chunk-CEPNSHIC.js';
@@ -11,6 +11,7 @@ import './chunk-E6HSKRAE.js';
11
11
  import './chunk-B7DOQ5QF.js';
12
12
  import './chunk-33QMFE2Z.js';
13
13
  import './chunk-EEVNLTB4.js';
14
+ import './chunk-NDW52ZK3.js';
14
15
  import './chunk-XOTCIXY6.js';
15
16
  import './chunk-E2XU6NOW.js';
16
17
  import './chunk-ENQ7O7VW.js';
@@ -34,7 +35,8 @@ var pk = {
34
35
  landline: schema("landline"),
35
36
  passport: schema("passport"),
36
37
  vehiclePlate: schema("vehiclePlate"),
37
- codPhone: schema("codPhone")
38
+ codPhone: schema("codPhone"),
39
+ amount: schema("amount")
38
40
  };
39
41
 
40
42
  export { pk };
package/dist/zod.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkXCFZKCV2_cjs = require('./chunk-XCFZKCV2.cjs');
3
+ var chunkYSRYWZCQ_cjs = require('./chunk-YSRYWZCQ.cjs');
4
4
  require('./chunk-ESKXG7Y6.cjs');
5
5
  require('./chunk-YDUXIENX.cjs');
6
6
  require('./chunk-H6M6L26S.cjs');
@@ -13,13 +13,14 @@ require('./chunk-7E7L3NYS.cjs');
13
13
  require('./chunk-QFPEFD67.cjs');
14
14
  require('./chunk-I7UUPD3G.cjs');
15
15
  require('./chunk-HTCSHHOR.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 zod = require('zod');
20
21
 
21
22
  function schema(name) {
22
- const rule = chunkXCFZKCV2_cjs.RULES[name];
23
+ const rule = chunkYSRYWZCQ_cjs.RULES[name];
23
24
  return (options = {}) => zod.z.string().refine(rule.test, { message: options.message ?? rule.message });
24
25
  }
25
26
  var pk = {
@@ -31,7 +32,8 @@ var pk = {
31
32
  landline: schema("landline"),
32
33
  passport: schema("passport"),
33
34
  vehiclePlate: schema("vehiclePlate"),
34
- codPhone: schema("codPhone")
35
+ codPhone: schema("codPhone"),
36
+ amount: schema("amount")
35
37
  };
36
38
 
37
39
  exports.pk = pk;
package/dist/zod.d.cts CHANGED
@@ -20,6 +20,7 @@ declare const pk: {
20
20
  passport: (options?: AdapterOptions) => z.ZodString;
21
21
  vehiclePlate: (options?: AdapterOptions) => z.ZodString;
22
22
  codPhone: (options?: AdapterOptions) => z.ZodString;
23
+ amount: (options?: AdapterOptions) => z.ZodString;
23
24
  };
24
25
 
25
26
  export { AdapterOptions, pk };
package/dist/zod.d.ts CHANGED
@@ -20,6 +20,7 @@ declare const pk: {
20
20
  passport: (options?: AdapterOptions) => z.ZodString;
21
21
  vehiclePlate: (options?: AdapterOptions) => z.ZodString;
22
22
  codPhone: (options?: AdapterOptions) => z.ZodString;
23
+ amount: (options?: AdapterOptions) => z.ZodString;
23
24
  };
24
25
 
25
26
  export { AdapterOptions, pk };
package/dist/zod.js CHANGED
@@ -1,4 +1,4 @@
1
- import { RULES } from './chunk-IDTRFOQW.js';
1
+ import { RULES } from './chunk-QG5T7YQ5.js';
2
2
  import './chunk-S274QFFB.js';
3
3
  import './chunk-UYFTXD4P.js';
4
4
  import './chunk-CEPNSHIC.js';
@@ -11,6 +11,7 @@ import './chunk-E6HSKRAE.js';
11
11
  import './chunk-B7DOQ5QF.js';
12
12
  import './chunk-33QMFE2Z.js';
13
13
  import './chunk-EEVNLTB4.js';
14
+ import './chunk-NDW52ZK3.js';
14
15
  import './chunk-XOTCIXY6.js';
15
16
  import './chunk-E2XU6NOW.js';
16
17
  import './chunk-ENQ7O7VW.js';
@@ -29,7 +30,8 @@ var pk = {
29
30
  landline: schema("landline"),
30
31
  passport: schema("passport"),
31
32
  vehiclePlate: schema("vehiclePlate"),
32
- codPhone: schema("codPhone")
33
+ codPhone: schema("codPhone"),
34
+ amount: schema("amount")
33
35
  };
34
36
 
35
37
  export { pk };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pakdatakit",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "Pakistani data utilities for TypeScript and JavaScript: validate CNIC, mobile, IBAN, NTN/STRN, passport and vehicle numbers; Raast QR codes, banks, mobile networks, postal codes, districts, holidays, Hijri dates and amounts in words. No dependencies, with Zod, Valibot, Yup, Joi, Superstruct and class-validator adapters.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -419,7 +419,7 @@
419
419
  "commonjs"
420
420
  ],
421
421
  "author": "Muzamil Chaudhery",
422
- "homepage": "https://github.com/chmuzamil/pakdatakit#readme",
422
+ "homepage": "https://pakdatakit.dev/",
423
423
  "bugs": {
424
424
  "url": "https://github.com/chmuzamil/pakdatakit/issues"
425
425
  },
@@ -434,21 +434,21 @@
434
434
  "devDependencies": {
435
435
  "@eslint/js": "^10.0.1",
436
436
  "@types/node": "^26.6.5",
437
- "@typescript-eslint/eslint-plugin": "^8.72.0",
437
+ "@typescript-eslint/eslint-plugin": "^8.72.2",
438
438
  "@typescript-eslint/parser": "^8.72.0",
439
439
  "class-validator": "^0.15.1",
440
- "eslint": "^10.13.0",
440
+ "eslint": "^10.15.0",
441
441
  "eslint-config-prettier": "^10.1.5",
442
- "globals": "^17.6.0",
442
+ "globals": "^17.14.0",
443
443
  "joi": "^18.3.2",
444
- "libphonenumber-js": "^1.13.15",
445
- "prettier": "^3.9.10",
444
+ "libphonenumber-js": "^1.13.16",
445
+ "prettier": "^3.10.1",
446
446
  "superstruct": "^2.0.2",
447
447
  "tsup": "^9.0.0",
448
448
  "typedoc": "^0.28.20",
449
449
  "typescript": "^5.8.3",
450
450
  "valibot": "^1.5.0",
451
- "vitest": "^5.0.5",
451
+ "vitest": "^5.1.0",
452
452
  "yup": "^1.7.1",
453
453
  "zod": "^4.6.7"
454
454
  },
@@ -1,38 +0,0 @@
1
- // src/format.ts
2
- var LAKH = 1e5;
3
- var CRORE = 1e7;
4
- var pkrFormatter = new Intl.NumberFormat("en-PK", {
5
- maximumFractionDigits: 0
6
- });
7
- function assertFinite(amount) {
8
- if (typeof amount !== "number" || !Number.isFinite(amount)) {
9
- throw new RangeError(
10
- `Amount must be a finite number, received ${String(amount)}`
11
- );
12
- }
13
- }
14
- function roundTo2(value) {
15
- return Math.round(value * 100) / 100;
16
- }
17
- function formatPKR(amount) {
18
- assertFinite(amount);
19
- const rounded = Math.round(Math.abs(amount));
20
- const sign = amount < 0 && rounded !== 0 ? "-" : "";
21
- return `${sign}Rs. ${pkrFormatter.format(rounded)}`;
22
- }
23
- function formatLakh(amount) {
24
- assertFinite(amount);
25
- const sign = amount < 0 ? "-" : "";
26
- const absolute = Math.abs(amount);
27
- const crores = roundTo2(absolute / CRORE);
28
- if (crores >= 1) {
29
- return `${sign}${crores} Crore`;
30
- }
31
- const lakhs = roundTo2(absolute / LAKH);
32
- if (lakhs >= 1) {
33
- return `${sign}${lakhs} Lakh`;
34
- }
35
- return formatPKR(amount);
36
- }
37
-
38
- export { formatLakh, formatPKR };
@@ -1,41 +0,0 @@
1
- 'use strict';
2
-
3
- // src/format.ts
4
- var LAKH = 1e5;
5
- var CRORE = 1e7;
6
- var pkrFormatter = new Intl.NumberFormat("en-PK", {
7
- maximumFractionDigits: 0
8
- });
9
- function assertFinite(amount) {
10
- if (typeof amount !== "number" || !Number.isFinite(amount)) {
11
- throw new RangeError(
12
- `Amount must be a finite number, received ${String(amount)}`
13
- );
14
- }
15
- }
16
- function roundTo2(value) {
17
- return Math.round(value * 100) / 100;
18
- }
19
- function formatPKR(amount) {
20
- assertFinite(amount);
21
- const rounded = Math.round(Math.abs(amount));
22
- const sign = amount < 0 && rounded !== 0 ? "-" : "";
23
- return `${sign}Rs. ${pkrFormatter.format(rounded)}`;
24
- }
25
- function formatLakh(amount) {
26
- assertFinite(amount);
27
- const sign = amount < 0 ? "-" : "";
28
- const absolute = Math.abs(amount);
29
- const crores = roundTo2(absolute / CRORE);
30
- if (crores >= 1) {
31
- return `${sign}${crores} Crore`;
32
- }
33
- const lakhs = roundTo2(absolute / LAKH);
34
- if (lakhs >= 1) {
35
- return `${sign}${lakhs} Lakh`;
36
- }
37
- return formatPKR(amount);
38
- }
39
-
40
- exports.formatLakh = formatLakh;
41
- exports.formatPKR = formatPKR;