@medipass/utils 11.79.1 → 11.79.2-chore-settlement-form-validations.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medipass/utils",
3
- "version": "11.79.1",
3
+ "version": "11.79.2-chore-settlement-form-validations.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -52,5 +52,5 @@
52
52
  "rimraf": "^2.6.2",
53
53
  "typescript": "4.8.4"
54
54
  },
55
- "gitHead": "9eb840ab49dd1df55376859df2eda02a7c6eedf6"
55
+ "gitHead": "11f973f6d67bcd9adad1eacbf3d8a2a92c088d35"
56
56
  }
@@ -1,3 +1,6 @@
1
+ export declare const IS_VALID_BANK_ACCOUNT_NAME_REGEX: RegExp;
2
+ export declare const IS_VALID_NUMBER_REGEX: RegExp;
3
+ export declare const IS_VALID_MEDIBANK_PROVIDER_NUMBER_REGEX: RegExp;
1
4
  export declare const isRequired: (value: any) => "This field is required" | undefined;
2
5
  export declare const isNumber: (value: any) => "This field must only contain numbers" | undefined;
3
6
  export declare const isEqualTo: (target: any, message?: string) => (value: any) => string | undefined;
package/validate-form.js CHANGED
@@ -20,6 +20,10 @@ var isValid = _interopDefault(require('date-fns/isValid'));
20
20
  var parse = _interopDefault(require('date-fns/parse'));
21
21
  var abn = require('./abn.js');
22
22
 
23
+ var IS_VALID_BANK_ACCOUNT_NAME_REGEX = new RegExp(/^[A-Za-z0-9^_[\]',?;:=#/.*()&%!$ @+-]+$/);
24
+ var IS_VALID_NUMBER_REGEX = new RegExp(/^\d+$/);
25
+ var IS_VALID_MEDIBANK_PROVIDER_NUMBER_REGEX = new RegExp(/[A-Z]{1}[0-9]{5,6}[A-Z]{1,2}/); // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
26
+
23
27
  var isRequired = function isRequired(value) {
24
28
  return !value || value.trim && !value.trim() || _isArray(value) && value.length === 0 ? 'This field is required' : undefined;
25
29
  }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
@@ -116,7 +120,7 @@ var hasNumber = function hasNumber(value) {
116
120
  // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
117
121
 
118
122
  var isValidBankAccountName = function isValidBankAccountName(value) {
119
- return /^[A-Za-z0-9^_[\]',?;:=#/.*()&%!$ @+-]+$/.test(value) ? undefined : 'Bank account name must not contain any special characters';
123
+ return IS_VALID_BANK_ACCOUNT_NAME_REGEX.test(value) ? undefined : 'Bank account name must not contain any special characters';
120
124
  }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
121
125
 
122
126
  var hasSpecialChar = function hasSpecialChar(value) {
@@ -415,6 +419,9 @@ function combineValidators() {
415
419
  );
416
420
  };
417
421
 
422
+ exports.IS_VALID_BANK_ACCOUNT_NAME_REGEX = IS_VALID_BANK_ACCOUNT_NAME_REGEX;
423
+ exports.IS_VALID_MEDIBANK_PROVIDER_NUMBER_REGEX = IS_VALID_MEDIBANK_PROVIDER_NUMBER_REGEX;
424
+ exports.IS_VALID_NUMBER_REGEX = IS_VALID_NUMBER_REGEX;
418
425
  exports.default = combineValidators;
419
426
  exports.hasDoubleSpaces = hasDoubleSpaces;
420
427
  exports.hasInvalidCharacters = hasInvalidCharacters;