This repository has been archived by the owner on Jan 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix adeli id errors for 9A 9B 9C 9D 9F 2A and 2B (#238)
- Loading branch information
1 parent
1d7ac67
commit 0da1689
Showing
5 changed files
with
54 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const formatAdeliId = (adeliId: string): string => { | ||
// Adeli ID is a 10-digit string, that can also contain letters for some departments. | ||
// e.g. "9A1234678" (Guadeloupe) or "2A1234678" (Corse-du-Sud). | ||
// In this particular function, we just want to remove non-alphanumeric (0 to 9 and A to F) characters | ||
// since it is sent to adeli service for complete checking. | ||
return (adeliId || "") | ||
.replace(/[^0-9a-f]/gi, "") | ||
.toUpperCase() | ||
.padStart(10, "0"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters