Skip to content

Commit

Permalink
fix: change GO ie to works with new format (#38)
Browse files Browse the repository at this point in the history
* fix: change GO ie to works with new format

* fix: remove digit 5 from support

Co-authored-by: Alisson Pereira <lissonpsantos2@yahoo.com.br>

---------

Co-authored-by: Alisson Pereira <lissonpsantos2@yahoo.com.br>
  • Loading branch information
dylan402 and lissonpsantos2 committed Nov 17, 2023
1 parent 3f878a7 commit bb86e53
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/__tests__/validateIE.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('Validate Email', () => {
});
it('should be able return true to valid GO IE', () => {
expect(validateIE('11.223.711-8', 'go')).toBe(true);
expect(validateIE('20.002.703-4', 'go')).toBe(true);
});
it('should be able return true to valid MA IE', () => {
expect(validateIE('12351768-0', 'ma')).toBe(true);
Expand Down
4 changes: 2 additions & 2 deletions src/validations/ie/states/go.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export function validateGO(ie: string): boolean {

if (length !== 9) return false;

const beginWith = ['10', '11', '15'];
const beginRegex = /^(1[01]|2[0-9])/;
const begin = ieStr.substr(0, 2);
if (!(beginWith.indexOf(begin) >= 0)) return false;
if (!beginRegex.test(begin)) return false;

const position = length - 1;
let weight = length;
Expand Down

0 comments on commit bb86e53

Please sign in to comment.