Skip to content

Commit 98e9382

Browse files
rubiinvlapo
authored andcommitted
feat: add all option in isuuid validator (#452)
1 parent f7a46ab commit 98e9382

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ validator.isMongoId(str); // Checks if the string is a valid hex-encoded represe
853853
validator.isMultibyte(str); // Checks if the string contains one or more multibyte chars.
854854
validator.isSurrogatePair(str); // Checks if the string contains any surrogate pairs chars.
855855
validator.isURL(str, options); // Checks if the string is an url.
856-
validator.isUUID(str, version); // Checks if the string is a UUID (version 3, 4 or 5).
856+
validator.isUUID(str, version); // Checks if the string is a UUID (version 3, 4, 5 or all).
857857
validator.isUppercase(str); // Checks if the string is uppercase.
858858
validator.length(str, min, max); // Checks if the string's length falls in a range.
859859
validator.minLength(str, min); // Checks if the string's length is not less than given number.
@@ -950,7 +950,7 @@ validator.isInstance(value, target); // Checks value is an instance of the targe
950950
| `@IsNumberString()` | Checks if the string is numeric. |
951951
| `@IsSurrogatePair()` | Checks if the string contains any surrogate pairs chars. |
952952
| `@IsUrl(options?: IsURLOptions)` | Checks if the string is an url. |
953-
| `@IsUUID(version?: "3"\|"4"\|"5")` | Checks if the string is a UUID (version 3, 4 or 5). |
953+
| `@IsUUID(version?: "3"\|"4"\|"5"\|"all")` | Checks if the string is a UUID (version 3, 4, 5 or all ). |
954954
| `@IsUppercase()` | Checks if the string is uppercase. |
955955
| `@Length(min: number, max?: number)` | Checks if the string's length falls in a range. |
956956
| `@MinLength(min: number)` | Checks if the string's length is not less than given number. |

Diff for: src/decorator/decorators.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ export function IsUrl(options?: ValidatorJS.IsURLOptions, validationOptions?: Va
11311131
/**
11321132
* Checks if the string is a UUID (version 3, 4 or 5).
11331133
*/
1134-
export function IsUUID(version?: "3"|"4"|"5", validationOptions?: ValidationOptions) {
1134+
export function IsUUID(version?: "3"|"4"|"5"|"all", validationOptions?: ValidationOptions) {
11351135
return function (object: Object, propertyName: string) {
11361136
const args: ValidationMetadataArgs = {
11371137
type: ValidationTypes.IS_UUID,

Diff for: src/validation/Validator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ export class Validator {
838838
* Checks if the string is a UUID (version 3, 4 or 5).
839839
* If given value is not a string, then it returns false.
840840
*/
841-
isUUID(value: unknown, version?: "3"|"4"|"5"): boolean {
841+
isUUID(value: unknown, version?: "3"|"4"|"5"|"all"): boolean {
842842
return typeof value === "string" && this.validatorJs.isUUID(value, version);
843843
}
844844

0 commit comments

Comments
 (0)