Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/br/cpf.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ describe('br/cpf', () => {
expect(result).toEqual('231.002.999-00');
});

it('format: 216.957.050-09', () => {
const result = format('216.957.050-09');

expect(result).toEqual('216.957.050-09');
});

Comment thread
juregdev marked this conversation as resolved.
it('validate:390.533.447-05', () => {
const result = validate('390.533.447-05');

Expand Down
2 changes: 1 addition & 1 deletion src/br/cpf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const impl: Validator = {
format(input: string): string {
const [value] = clean(input);

Comment thread
juregdev marked this conversation as resolved.
const [a, b, c, d] = strings.splitAt(value, 3, 6, input.length - 2);
const [a, b, c, d] = strings.splitAt(value, 3, 6, 9, 11);

return `${a}.${b}.${c}-${d}`;
},
Expand Down