@rhangai/validator
v0.9.2
Published
Validator
Downloads
84
Maintainers
Readme
@rhangai/validator
Installation
yarn add @rhangai/common @rhangai/validator reflect-metadata
Usage
import { ToString, ToInt, validate } from '@rhangai/validator';
class MyClass {
@ToString()
name!: string;
@ToInt()
age!: number;
}
async function test() {
const result = await validate(MyClass, {
name: 'John Doe',
age: 100,
});
/*
MyClass { name: 'John Doe', age: 100 }
*/
}