Skip to content

Commit

Permalink
fix(validators): fix validator on empty cpf field
Browse files Browse the repository at this point in the history
  • Loading branch information
abalad committed Nov 14, 2019
1 parent 15c409b commit 61884c2
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export function CPFValidator( ): ValidatorFn {
let sum = 0;
let leftover;

if ( (cpfUnmasked( control ) === null) || (cpfUnmasked( control ).length < 9) ) {
if ( cpfUnmasked( control ) === null) {
return null;
}

if ( cpfUnmasked( control ) != null && cpfUnmasked( control ).length < 9 ) {
return { cpf: LOCALE_I18N.Validators.invalidCPF };
}

Expand Down

0 comments on commit 61884c2

Please sign in to comment.