@fiado/type-kit 1.1.73 → 1.1.77
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.
|
@@ -11,6 +11,9 @@ const class_validator_1 = require("class-validator");
|
|
|
11
11
|
const regex_1 = require("../../helpers/constans/regex");
|
|
12
12
|
let IsPhoneNumberConstraint = class IsPhoneNumberConstraint {
|
|
13
13
|
validate(phoneNumber, args) {
|
|
14
|
+
if (phoneNumber === undefined || phoneNumber === null || "") {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
14
17
|
return regex_1.regexPhoneNumber.test(phoneNumber);
|
|
15
18
|
}
|
|
16
19
|
defaultMessage(args) {
|
package/package.json
CHANGED
|
@@ -4,6 +4,9 @@ import { regexPhoneNumber } from '../../helpers/constans/regex';
|
|
|
4
4
|
@ValidatorConstraint({ async: true })
|
|
5
5
|
export class IsPhoneNumberConstraint implements ValidatorConstraintInterface {
|
|
6
6
|
validate(phoneNumber: string, args: ValidationArguments) {
|
|
7
|
+
if (phoneNumber === undefined || phoneNumber === null || "") {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
7
10
|
return regexPhoneNumber.test(phoneNumber);
|
|
8
11
|
}
|
|
9
12
|
|