This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

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

1.0.21 • Public • Published

Validators

list

  • class validator utils
  • class validator rules

usage

class Test {
    @IsNotEmpty()
    name: string;

    @IsNotEmpty()
    @Max(50)
    age: number;
}

const form = new Form(new Test());

// ❌
await form.validate(); // false
form.rawErrors; // { name: ['Is not empty'], age: ['Is not empty', 'age must be greater than 50'] }

// ❌
form.setDataProperty('name', 'Jhon Doe');
form.setDataProperty('age', 60);
await form.validate(); // false
form.rawErrors; // { age: ['age must be greater than 50'] }

// ✅
form.setDataProperty('age', 37);
await form.validate(); // true

Readme

Keywords

none

Package Sidebar

Install

npm i @caredoc/validator

Weekly Downloads

0

Version

1.0.21

License

ISC

Unpacked Size

35.2 kB

Total Files

32

Last publish

Collaborators

  • caredoc_dan
  • caredoc_julie
  • caredoc_kyle
  • caredoc_roy