multiform-validator
Version:
Javascript library made to validate, several form fields, such as: email, images, phone, password, cpf etc.
19 lines (18 loc) • 664 B
TypeScript
import type { ValidateFunctions } from "./types";
/**
* @param cnpj
* @param errorMsg optional
* @example cnpjIsValid('72.501.263/0001-40');
* @description This function returns four errors in the following order,
*
* If you want to use a default parameter, use null or leave Empty.
*
* Default:
* ['CNPJ invalid', 'CNPJ must have 14 numerical digits', 'CNPJ is not valid']
* .
*
* Create a list of errors separated by commas in strings
* @returns An object with 'isValid' (boolean) and 'errorMsg' (string) properties.
*/
declare function cnpjIsValid(cnpj: string, errorMsg?: (string | null)[] | null): ValidateFunctions;
export default cnpjIsValid;