How to use the js-brasil.validateBr.cnpj function in js-brasil

To help you get started, we’ve selected a few js-brasil examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mariohmol / ng-brazil / ng-brazil / src / cnpj / validator.ts View on Github external
export const cnpj: ValidatorFn = (control: AbstractControl): {[key: string]: boolean} => {
  if (utilsBr.isPresent(Validators.required(control))) {
    return null;
  }

  const v: string = control.value;
  return validateBr.cnpj(v) ? null : {cnpj: true};
}