Skip to content

pay-k/class-validator-extras

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Class Validator Extras

Install

npm install @payk/class-validator-extras

Usage

ValidateWithCondition

The decorator needs to define a function that receives two values, an object of the current class and the value of the current property. It needs to return a boolean. You can also pass the options object and override the message for your usage.

class MyClass {

    startDate: Date;

    @ValidateWithCondition((obj: MyClass, val: Date) => val > obj.startDate, { message: 'ExpirationDate must be after the StartDate' })
    expirationDate: Date;
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published