Skip to content

Commit

Permalink
review-fix:convertZipCode関数を外部へ切り出し
Browse files Browse the repository at this point in the history
  • Loading branch information
marumoto-goq committed May 2, 2024
1 parent 1460aa4 commit 6a02281
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/test/utils/convertZipCode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const convertZipCode = (testZipCode: string): string => {
const halfWidthZipCode: string = testZipCode.replace(
/[0-9]/g,
(s: string) => String.fromCharCode(s.charCodeAt(0) - 65248)
);

const halfWidthZipCodeExcludingHyphen = halfWidthZipCode.replaceAll(
/\D/g,
''
);

return halfWidthZipCodeExcludingHyphen;
};

0 comments on commit 6a02281

Please sign in to comment.