quantique-field-validator 1.0.5-beta → 1.0.5
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.
|
@@ -8,7 +8,7 @@ const validateGST = (value, rules, defaultErrorMessages, type) => {
|
|
|
8
8
|
isValid: false,
|
|
9
9
|
error:
|
|
10
10
|
rules?.errorMessages?.regex ||
|
|
11
|
-
"Please
|
|
11
|
+
"Please entere a valid GSTIN number" ||
|
|
12
12
|
defaultErrorMessages(rules, type).invalid,
|
|
13
13
|
};
|
|
14
14
|
}
|
|
@@ -4,27 +4,16 @@ const validatePanCard = (
|
|
|
4
4
|
defaultErrorMessages,
|
|
5
5
|
type
|
|
6
6
|
) => {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
};
|
|
7
|
+
const defaultRegex = /^[A-Z]{5}[0-9]{4}[A-Z]{1}$/;
|
|
8
|
+
const regexToUse = rules?.regex ? new RegExp(rules.regex) : defaultRegex;
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
const effectiveRules = {
|
|
13
|
-
...defaultRules,
|
|
14
|
-
...rules,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (
|
|
20
|
-
effectiveRules?.regex &&
|
|
21
|
-
!new RegExp(effectiveRules?.regex).test(value)
|
|
22
|
-
) {
|
|
10
|
+
if (!regexToUse.test(value)) {
|
|
23
11
|
return {
|
|
24
12
|
isValid: false,
|
|
25
13
|
error:
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
rules?.errorMessages?.regex ||
|
|
15
|
+
rules?.errorMessages?.invalid ||
|
|
16
|
+
defaultErrorMessages(rules, type).invalid,
|
|
28
17
|
};
|
|
29
18
|
}
|
|
30
19
|
|