# @caredoc/validator

> Caredoc Validator Things

Latest version **1.0.21** (published 2021-05-13) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @caredoc/validator
pnpm add @caredoc/validator
yarn add @caredoc/validator
bun add @caredoc/validator
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.21 |
| Published | 2021-05-13 |
| First published | 2021-03-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 34.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | caredoc_ethan, caredoc-lay, caredoc_jake, caredoc_roy, fifthsage |

## Links

- npm: https://www.npmjs.com/package/@caredoc/validator
- npm.io page: https://npm.io/package/@caredoc/validator

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [date-fns](https://npm.io/package/date-fns.md) ^2.19.0
- [class-validator](https://npm.io/package/class-validator.md) 0.13.1

## Recent versions

- 1.0.21 (latest) — 2021-05-13
- 1.0.20 — 2021-05-06
- 1.0.19 — 2021-05-06
- 1.0.18 — 2021-05-06
- 1.0.17 — 2021-05-03
- 1.0.16 — 2021-03-29
- 1.0.15 — 2021-03-29
- 1.0.14 — 2021-03-29
- 1.0.13 — 2021-03-29
- 1.0.12 — 2021-03-29
- 1.0.11 — 2021-03-29
- 1.0.10 — 2021-03-29
- 1.0.9 — 2021-03-29
- 1.0.8 — 2021-03-29
- 1.0.7 — 2021-03-29
- … 6 more at https://npm.io/package/@caredoc/validator/versions

## README

# Validators

## list

- class validator utils
- class validator rules

## usage

```typescript
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
```

---
_Source: https://npm.io/package/@caredoc/validator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
