@lacussoft/cpf-fmt
Version:
Utility function to format CPF (Brazilian ID document).
26 lines (23 loc) • 606 B
TypeScript
type DeepPartial<T> = {
[P in keyof T]?: DeepPartial<T[P]>;
};
interface ActualCpfFormattingOptions<ER = unknown> {
delimiters: {
dash: string;
dot: string;
};
escape: boolean;
hidden: boolean;
hiddenKey: string;
hiddenRange: {
end: number;
start: number;
};
onFail: (value: string, error: Error) => ER;
}
type CpfFormattingOptions = DeepPartial<ActualCpfFormattingOptions>;
/**
* Validate a given CPF char sequence.
*/
declare function cpfFmt(cpfString: string, options?: CpfFormattingOptions): string;
export { cpfFmt as default };