TypeScript validation
npm install overshom-valid> Powerful TypeScript validation
* đĒ Completely typed runtime validation with TypeScript.
* đ§ Full intellisense support.
* [ âšī¸, âšī¸, âšī¸ ] Accumulated errors = see all validation errors at once.
* đ Breadcrumbs-enhanced errors let you understand exact key failed validation.
* â Intuitive schema definitions and clear return type.
* đ Easily customizable.
* đĢ Zero dependecy.
`` sh`
yarn add overshom-validor
npm i overshom-valid
` ts
import { v } from 'overshom-valid'
enum USER_ROLE {
USER = 'USER',
ADMIN = 'ADMIN',
}
const UserDto = v.class({
login: v
.String()
.min(4)
.max(16)
.pattern(/^\w+$/),
role: v.Object({
type: v.Enum(USER_ROLE),
}),
avatar: v
.String()
.optional(),
})
const user = new UserDto({
"login": "overshom",
"role": {
"type": "ADMIN"
}
})`
Inspect *.spec.ts files inside ./src/` directory to see more use cases of validations.