brazilian-class-validator
v0.1.6
Published
Additional decorators for class-validator using validators for Brazilian values
Downloads
4,471
Maintainers
Readme
brazilian-class-validator
Additional decorators for class-validator using validators for Brazilian values
Brazilian Validators came from brazilian-values
Install
# Using npm
npm install brazilian-values --save
# Using yarn
yarn add brazilian-values
Use
The use of brazilian-class-validator
is just like using class-validator
decorators.
import { IsCPF, IsDate } from 'brazilian-class-validator';
import { validate } from 'class-validator';
class BrazilianGuy {
@IsCPF()
cpf: string;
@IsDate()
birthday: string;
}
const bg = new BrazilianGuy();
bg.cpf = "123";
bg.birthday = "30/12/2004";
validate(bg).then(errors => console.log(errors));