1 | const cpfFormat = (value: string) => {
|
2 | value = value.replace(/\D/g, '');
|
3 | value = value.replace(/(\d{3})(\d)/, '$1.$2');
|
4 | value = value.replace(/(\d{3})(\d)/, '$1.$2');
|
5 | value = value.replace(/(\d{3})(\d{1,2})$/, '$1-$2');
|
6 | return value;
|
7 | };
|
8 |
|
9 | export default cpfFormat;
|