Skip to content

Commit 924fa62

Browse files
author
Umed Khudoiberdiev
committed
updated all dependencies; updated validator library dependency; removed isDateString decorator; version bump
1 parent 6d58881 commit 924fa62

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/validation/Validator.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ export class Validator {
6969
/**
7070
* Performs validation of the given object based on decorators or validation schema and reject on error.
7171
*/
72-
validateOrReject(objectOrSchemaName: Object|string, objectOrValidationOptions: Object|ValidationOptions, maybeValidatorOptions?: ValidatorOptions): Promise<void> {
73-
return this.coreValidate(objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions)
74-
.then((validationErorrs: ValidationError[]) => (validationErorrs.length > 0) ? Promise.reject(validationErorrs) : Promise.resolve());
72+
async validateOrReject(objectOrSchemaName: Object|string, objectOrValidationOptions: Object|ValidationOptions, maybeValidatorOptions?: ValidatorOptions): Promise<void> {
73+
const errors = await this.coreValidate(objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions);
74+
if (errors.length)
75+
return Promise.reject(errors);
7576
}
7677

7778
/**

0 commit comments

Comments
 (0)