@medipass/utils 11.84.4 → 11.84.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.
- package/package.json +2 -2
- package/validate-form.d.ts +1 -0
- package/validate-form.js +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medipass/utils",
|
|
3
|
-
"version": "11.84.
|
|
3
|
+
"version": "11.84.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"rimraf": "^2.6.2",
|
|
49
49
|
"typescript": "4.8.4"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "04d7103ae52cbec56acb463abfbe0ebd3ef22fe7"
|
|
52
52
|
}
|
package/validate-form.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare const IS_VALID_NUMBER_REGEX: RegExp;
|
|
|
3
3
|
export declare const IS_VALID_BANK_ACCOUNT_NAME_REGEX_OPTIONAL: RegExp;
|
|
4
4
|
export declare const IS_VALID_NUMBER_REGEX_OPTIONAL: RegExp;
|
|
5
5
|
export declare const IS_VALID_MEDIBANK_PROVIDER_NUMBER_REGEX: RegExp;
|
|
6
|
+
export declare const validEmailRegex: RegExp;
|
|
6
7
|
export declare const isRequired: (value: any) => "This field is required" | undefined;
|
|
7
8
|
export declare const isNumber: (value: any) => "This field must only contain numbers" | undefined;
|
|
8
9
|
export declare const isEqualTo: (target: any, message?: string) => (value: any) => string | undefined;
|
package/validate-form.js
CHANGED
|
@@ -34,7 +34,8 @@ var IS_VALID_BANK_ACCOUNT_NAME_REGEX = new RegExp(/^[A-Za-z0-9^_[\]',?;:=#/.*()&
|
|
|
34
34
|
var IS_VALID_NUMBER_REGEX = new RegExp(/^\d+$/);
|
|
35
35
|
var IS_VALID_BANK_ACCOUNT_NAME_REGEX_OPTIONAL = new RegExp(/^$|^[A-Za-z0-9^_[\]',?;:=#/.*()&%!$ @+-]+$/);
|
|
36
36
|
var IS_VALID_NUMBER_REGEX_OPTIONAL = new RegExp(/^$|^\d+$/);
|
|
37
|
-
var IS_VALID_MEDIBANK_PROVIDER_NUMBER_REGEX = new RegExp(/[A-Z]{1}[0-9]{5,6}[A-Z]{1,2}/);
|
|
37
|
+
var IS_VALID_MEDIBANK_PROVIDER_NUMBER_REGEX = new RegExp(/[A-Z]{1}[0-9]{5,6}[A-Z]{1,2}/);
|
|
38
|
+
var validEmailRegex = new RegExp("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"); // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
|
|
38
39
|
|
|
39
40
|
var isRequired = function isRequired(value) {
|
|
40
41
|
return !value || value.trim && !value.trim() || _isArray__default["default"](value) && value.length === 0 ? 'This field is required' : undefined;
|
|
@@ -189,7 +190,7 @@ var isValidEmailAsync = /*#__PURE__*/function () {
|
|
|
189
190
|
}(); // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
|
|
190
191
|
|
|
191
192
|
var isValidEmail = function isValidEmail(value) {
|
|
192
|
-
return !value ||
|
|
193
|
+
return !value || validEmailRegex != null && validEmailRegex.test(value) ? undefined : 'Please enter a valid email';
|
|
193
194
|
}; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
|
|
194
195
|
|
|
195
196
|
var isValidMobile = function isValidMobile(value) {
|
|
@@ -460,3 +461,4 @@ exports.isValidMobile = isValidMobile;
|
|
|
460
461
|
exports.isValidUrlAsync = isValidUrlAsync;
|
|
461
462
|
exports.isYearInRange = isYearInRange;
|
|
462
463
|
exports.matchesRegex = matchesRegex;
|
|
464
|
+
exports.validEmailRegex = validEmailRegex;
|