Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | 1x 1x 5x | import { ValidationArguments, ValidatorConstraint, ValidatorConstraintInterface } from "class-validator";
@ValidatorConstraint({name:'AngolanBIValidator', async: false})
export class AngolanBIValidator implements ValidatorConstraintInterface {
validate(value: any): Promise<boolean> | boolean {
return typeof value === 'string' && /^\d{9}[A-Z]{2}\d{3}$/.test(value);
}
defaultMessage(args: ValidationArguments): string {
return `${args.property} deve ser um BI angolano vĂ¡lido (Ex: 005928773LA049)`;
}
} |