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.
- package/DATA.md +83 -7
- package/README.md +94 -31
- package/dist/{chunk-LQHM3ADX.js → chunk-33JPVN33.js} +11 -6
- package/dist/{chunk-XCFZKCV2.cjs → chunk-36K225SE.cjs} +14 -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-NDW52ZK3.js +85 -0
- package/dist/chunk-NLSIAPZG.cjs +90 -0
- package/dist/{chunk-IDTRFOQW.js → chunk-OYQJQE5R.js} +10 -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 +18 -9
- package/dist/class-validator.d.cts +12 -3
- package/dist/class-validator.d.ts +12 -3
- package/dist/class-validator.js +17 -9
- 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/format.cjs +11 -3
- package/dist/format.d.cts +57 -1
- package/dist/format.d.ts +57 -1
- package/dist/format.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 +67 -47
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +10 -10
- package/dist/input.cjs +8 -8
- package/dist/input.js +2 -2
- package/dist/joi.cjs +10 -8
- package/dist/joi.d.cts +2 -1
- package/dist/joi.d.ts +2 -1
- package/dist/joi.js +9 -7
- 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 +10 -8
- package/dist/superstruct.d.cts +2 -1
- package/dist/superstruct.d.ts +2 -1
- package/dist/superstruct.js +9 -7
- 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 +16 -8
- package/dist/valibot.d.cts +2 -1
- package/dist/valibot.d.ts +2 -1
- package/dist/valibot.js +15 -7
- package/dist/words.d.cts +4 -1
- package/dist/words.d.ts +4 -1
- package/dist/yup.cjs +10 -8
- package/dist/yup.d.cts +2 -1
- package/dist/yup.d.ts +2 -1
- package/dist/yup.js +9 -7
- package/dist/zod.cjs +12 -8
- package/dist/zod.d.cts +2 -1
- package/dist/zod.d.ts +2 -1
- package/dist/zod.js +11 -7
- package/package.json +2 -2
- package/dist/chunk-6TSKA2PH.js +0 -38
- package/dist/chunk-EEVNLTB4.js +0 -32
- package/dist/chunk-HTCSHHOR.cjs +0 -35
- package/dist/chunk-LVHTH4P7.cjs +0 -41
package/dist/valibot.cjs
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
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
|
+
require('./chunk-NLSIAPZG.cjs');
|
|
16
17
|
require('./chunk-33GOK7EE.cjs');
|
|
17
18
|
require('./chunk-E6GWBOKV.cjs');
|
|
18
19
|
require('./chunk-VPBMIYO2.cjs');
|
|
@@ -39,8 +40,14 @@ function _interopNamespace(e) {
|
|
|
39
40
|
var v__namespace = /*#__PURE__*/_interopNamespace(v);
|
|
40
41
|
|
|
41
42
|
function schema(name) {
|
|
42
|
-
const rule =
|
|
43
|
-
return (options = {}) => v__namespace.pipe(
|
|
43
|
+
const rule = chunk36K225SE_cjs.RULES[name];
|
|
44
|
+
return (options = {}) => v__namespace.pipe(
|
|
45
|
+
v__namespace.string(),
|
|
46
|
+
v__namespace.check(
|
|
47
|
+
(value) => rule.test(value, options),
|
|
48
|
+
options.message ?? rule.message
|
|
49
|
+
)
|
|
50
|
+
);
|
|
44
51
|
}
|
|
45
52
|
var pk = {
|
|
46
53
|
cnic: schema("cnic"),
|
|
@@ -51,7 +58,8 @@ var pk = {
|
|
|
51
58
|
landline: schema("landline"),
|
|
52
59
|
passport: schema("passport"),
|
|
53
60
|
vehiclePlate: schema("vehiclePlate"),
|
|
54
|
-
codPhone: schema("codPhone")
|
|
61
|
+
codPhone: schema("codPhone"),
|
|
62
|
+
amount: schema("amount")
|
|
55
63
|
};
|
|
56
64
|
|
|
57
65
|
exports.pk = pk;
|
package/dist/valibot.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import { A as AdapterOptions } from './rules-
|
|
2
|
+
import { A as AdapterOptions } from './rules-GEELAOfb.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Valibot schemas for Pakistani identifiers.
|
|
@@ -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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import { A as AdapterOptions } from './rules-
|
|
2
|
+
import { A as AdapterOptions } from './rules-GEELAOfb.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Valibot schemas for Pakistani identifiers.
|
|
@@ -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,16 +1,17 @@
|
|
|
1
|
-
import { RULES } from './chunk-
|
|
1
|
+
import { RULES } from './chunk-OYQJQE5R.js';
|
|
2
2
|
import './chunk-S274QFFB.js';
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
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-
|
|
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-
|
|
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';
|
|
@@ -18,7 +19,13 @@ import * as v from 'valibot';
|
|
|
18
19
|
|
|
19
20
|
function schema(name) {
|
|
20
21
|
const rule = RULES[name];
|
|
21
|
-
return (options = {}) => v.pipe(
|
|
22
|
+
return (options = {}) => v.pipe(
|
|
23
|
+
v.string(),
|
|
24
|
+
v.check(
|
|
25
|
+
(value) => rule.test(value, options),
|
|
26
|
+
options.message ?? rule.message
|
|
27
|
+
)
|
|
28
|
+
);
|
|
22
29
|
}
|
|
23
30
|
var pk = {
|
|
24
31
|
cnic: schema("cnic"),
|
|
@@ -29,7 +36,8 @@ var pk = {
|
|
|
29
36
|
landline: schema("landline"),
|
|
30
37
|
passport: schema("passport"),
|
|
31
38
|
vehiclePlate: schema("vehiclePlate"),
|
|
32
|
-
codPhone: schema("codPhone")
|
|
39
|
+
codPhone: schema("codPhone"),
|
|
40
|
+
amount: schema("amount")
|
|
33
41
|
};
|
|
34
42
|
|
|
35
43
|
export { pk };
|
package/dist/words.d.cts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Language for numbers and amounts in words: `'en'` for English with lakh and
|
|
3
|
+
* crore, `'ur'` for Urdu script.
|
|
4
|
+
*/
|
|
2
5
|
type WordsLanguage = 'en' | 'ur';
|
|
3
6
|
/** Options for {@link numberToWords}. */
|
|
4
7
|
interface NumberToWordsOptions {
|
package/dist/words.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Language for numbers and amounts in words: `'en'` for English with lakh and
|
|
3
|
+
* crore, `'ur'` for Urdu script.
|
|
4
|
+
*/
|
|
2
5
|
type WordsLanguage = 'en' | 'ur';
|
|
3
6
|
/** Options for {@link numberToWords}. */
|
|
4
7
|
interface NumberToWordsOptions {
|
package/dist/yup.cjs
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
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
|
+
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 =
|
|
23
|
+
const rule = chunk36K225SE_cjs.RULES[name];
|
|
23
24
|
return (options = {}) => yup.string().test(
|
|
24
25
|
`pk-${name}`,
|
|
25
26
|
options.message ?? rule.message,
|
|
26
27
|
// Leave empty values to .required() so optional fields still pass.
|
|
27
|
-
(value) => value === void 0 || value === null || value === "" || rule.test(value)
|
|
28
|
+
(value) => value === void 0 || value === null || value === "" || rule.test(value, options)
|
|
28
29
|
);
|
|
29
30
|
}
|
|
30
31
|
var pk = {
|
|
@@ -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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
import { A as AdapterOptions } from './rules-
|
|
2
|
+
import { A as AdapterOptions } from './rules-GEELAOfb.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Yup schemas for Pakistani identifiers.
|
|
@@ -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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
import { A as AdapterOptions } from './rules-
|
|
2
|
+
import { A as AdapterOptions } from './rules-GEELAOfb.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Yup schemas for Pakistani identifiers.
|
|
@@ -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,16 +1,17 @@
|
|
|
1
|
-
import { RULES } from './chunk-
|
|
1
|
+
import { RULES } from './chunk-OYQJQE5R.js';
|
|
2
2
|
import './chunk-S274QFFB.js';
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
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-
|
|
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-
|
|
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';
|
|
@@ -22,7 +23,7 @@ function schema(name) {
|
|
|
22
23
|
`pk-${name}`,
|
|
23
24
|
options.message ?? rule.message,
|
|
24
25
|
// Leave empty values to .required() so optional fields still pass.
|
|
25
|
-
(value) => value === void 0 || value === null || value === "" || rule.test(value)
|
|
26
|
+
(value) => value === void 0 || value === null || value === "" || rule.test(value, options)
|
|
26
27
|
);
|
|
27
28
|
}
|
|
28
29
|
var pk = {
|
|
@@ -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,26 +1,29 @@
|
|
|
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
|
+
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 =
|
|
23
|
-
return (options = {}) => zod.z.string().refine(rule.test,
|
|
23
|
+
const rule = chunk36K225SE_cjs.RULES[name];
|
|
24
|
+
return (options = {}) => zod.z.string().refine((value) => rule.test(value, options), {
|
|
25
|
+
message: options.message ?? rule.message
|
|
26
|
+
});
|
|
24
27
|
}
|
|
25
28
|
var pk = {
|
|
26
29
|
cnic: schema("cnic"),
|
|
@@ -31,7 +34,8 @@ var pk = {
|
|
|
31
34
|
landline: schema("landline"),
|
|
32
35
|
passport: schema("passport"),
|
|
33
36
|
vehiclePlate: schema("vehiclePlate"),
|
|
34
|
-
codPhone: schema("codPhone")
|
|
37
|
+
codPhone: schema("codPhone"),
|
|
38
|
+
amount: schema("amount")
|
|
35
39
|
};
|
|
36
40
|
|
|
37
41
|
exports.pk = pk;
|
package/dist/zod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { A as AdapterOptions } from './rules-
|
|
2
|
+
import { A as AdapterOptions } from './rules-GEELAOfb.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Zod schemas for Pakistani identifiers.
|
|
@@ -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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { A as AdapterOptions } from './rules-
|
|
2
|
+
import { A as AdapterOptions } from './rules-GEELAOfb.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Zod schemas for Pakistani identifiers.
|
|
@@ -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,16 +1,17 @@
|
|
|
1
|
-
import { RULES } from './chunk-
|
|
1
|
+
import { RULES } from './chunk-OYQJQE5R.js';
|
|
2
2
|
import './chunk-S274QFFB.js';
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
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-
|
|
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-
|
|
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';
|
|
@@ -18,7 +19,9 @@ import { z } from 'zod';
|
|
|
18
19
|
|
|
19
20
|
function schema(name) {
|
|
20
21
|
const rule = RULES[name];
|
|
21
|
-
return (options = {}) => z.string().refine(rule.test,
|
|
22
|
+
return (options = {}) => z.string().refine((value) => rule.test(value, options), {
|
|
23
|
+
message: options.message ?? rule.message
|
|
24
|
+
});
|
|
22
25
|
}
|
|
23
26
|
var pk = {
|
|
24
27
|
cnic: schema("cnic"),
|
|
@@ -29,7 +32,8 @@ var pk = {
|
|
|
29
32
|
landline: schema("landline"),
|
|
30
33
|
passport: schema("passport"),
|
|
31
34
|
vehiclePlate: schema("vehiclePlate"),
|
|
32
|
-
codPhone: schema("codPhone")
|
|
35
|
+
codPhone: schema("codPhone"),
|
|
36
|
+
amount: schema("amount")
|
|
33
37
|
};
|
|
34
38
|
|
|
35
39
|
export { pk };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pakdatakit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.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://
|
|
422
|
+
"homepage": "https://pakdatakit.dev/",
|
|
423
423
|
"bugs": {
|
|
424
424
|
"url": "https://github.com/chmuzamil/pakdatakit/issues"
|
|
425
425
|
},
|
package/dist/chunk-6TSKA2PH.js
DELETED
|
@@ -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 };
|
package/dist/chunk-EEVNLTB4.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { toAsciiDigits } from './chunk-ENQ7O7VW.js';
|
|
2
|
-
|
|
3
|
-
// src/cnic.ts
|
|
4
|
-
var CNIC_PATTERN = /^[1-8]\d{4}([-‐‑‒–—. ]?)\d{7}\1\d$/;
|
|
5
|
-
function validateCNIC(cnic) {
|
|
6
|
-
return CNIC_PATTERN.test(toAsciiDigits(cnic.trim()));
|
|
7
|
-
}
|
|
8
|
-
var CNIC_PROVINCES = {
|
|
9
|
-
"1": "Khyber Pakhtunkhwa",
|
|
10
|
-
"2": "Khyber Pakhtunkhwa",
|
|
11
|
-
"3": "Punjab",
|
|
12
|
-
"4": "Sindh",
|
|
13
|
-
"5": "Balochistan",
|
|
14
|
-
"6": "Islamabad Capital Territory",
|
|
15
|
-
"7": "Gilgit-Baltistan",
|
|
16
|
-
"8": "Azad Jammu and Kashmir"
|
|
17
|
-
};
|
|
18
|
-
function getCNICInfo(cnic) {
|
|
19
|
-
if (!validateCNIC(cnic)) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
const digits = toAsciiDigits(cnic).replace(/\D/g, "");
|
|
23
|
-
const lastDigit = Number(digits[12]);
|
|
24
|
-
return {
|
|
25
|
-
digits,
|
|
26
|
-
formatted: `${digits.slice(0, 5)}-${digits.slice(5, 12)}-${digits[12]}`,
|
|
27
|
-
province: CNIC_PROVINCES[digits[0]],
|
|
28
|
-
gender: lastDigit % 2 === 1 ? "male" : "female"
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { getCNICInfo, validateCNIC };
|
package/dist/chunk-HTCSHHOR.cjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkVPBMIYO2_cjs = require('./chunk-VPBMIYO2.cjs');
|
|
4
|
-
|
|
5
|
-
// src/cnic.ts
|
|
6
|
-
var CNIC_PATTERN = /^[1-8]\d{4}([-‐‑‒–—. ]?)\d{7}\1\d$/;
|
|
7
|
-
function validateCNIC(cnic) {
|
|
8
|
-
return CNIC_PATTERN.test(chunkVPBMIYO2_cjs.toAsciiDigits(cnic.trim()));
|
|
9
|
-
}
|
|
10
|
-
var CNIC_PROVINCES = {
|
|
11
|
-
"1": "Khyber Pakhtunkhwa",
|
|
12
|
-
"2": "Khyber Pakhtunkhwa",
|
|
13
|
-
"3": "Punjab",
|
|
14
|
-
"4": "Sindh",
|
|
15
|
-
"5": "Balochistan",
|
|
16
|
-
"6": "Islamabad Capital Territory",
|
|
17
|
-
"7": "Gilgit-Baltistan",
|
|
18
|
-
"8": "Azad Jammu and Kashmir"
|
|
19
|
-
};
|
|
20
|
-
function getCNICInfo(cnic) {
|
|
21
|
-
if (!validateCNIC(cnic)) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
const digits = chunkVPBMIYO2_cjs.toAsciiDigits(cnic).replace(/\D/g, "");
|
|
25
|
-
const lastDigit = Number(digits[12]);
|
|
26
|
-
return {
|
|
27
|
-
digits,
|
|
28
|
-
formatted: `${digits.slice(0, 5)}-${digits.slice(5, 12)}-${digits[12]}`,
|
|
29
|
-
province: CNIC_PROVINCES[digits[0]],
|
|
30
|
-
gender: lastDigit % 2 === 1 ? "male" : "female"
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
exports.getCNICInfo = getCNICInfo;
|
|
35
|
-
exports.validateCNIC = validateCNIC;
|
package/dist/chunk-LVHTH4P7.cjs
DELETED
|
@@ -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;
|