@payk/class-validator-extras
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

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;
}

Package Sidebar

Install

npm i @payk/class-validator-extras

Weekly Downloads

1

Version

1.0.9

License

ISC

Unpacked Size

6.44 kB

Total Files

11

Last publish

Collaborators

  • dankopayk
  • danpayk
  • one_eye_jackei
  • oromano