@peralva/validate-cpf-cnpj
Version:
Validate CPF and CNPJ
42 lines (36 loc) • 846 B
TypeScript
type Issue = {
data: {
received: string;
parsed: string;
};
} & ({
type: 'length';
expected: [11, 14];
received: number;
} | ({
data: {
masked: string;
};
} & ({
type: 'digits';
expected: string;
received: string;
} | {
type: 'sequential';
})));
type IssueWithDefaultError = Issue & {
defaultError: string;
};
type ErrorMap = (issue: IssueWithDefaultError) => string | undefined;
declare const _default: (data: string, { errorMap, clearData, }?: {
errorMap?: ErrorMap;
clearData?: boolean;
}) => {
parsed: string;
masked: string;
};
declare class export_default extends Error {
issue: IssueWithDefaultError;
constructor(issue: Issue, errorMap?: ErrorMap);
}
export { export_default as CpfCnpjError, type ErrorMap, _default as validateCpfCnpj };