Skip to content

Commit

Permalink
review-fix:convertHyphenatedZipCode関数が扱う対象のデータを住所の配列から郵便番号のみに変更、汎用的に使…
Browse files Browse the repository at this point in the history
…用可能な関数にするため
  • Loading branch information
marumoto-goq committed May 2, 2024
1 parent cb19868 commit 0791deb
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions src/test/utils/goqZipCode.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import type {
HyphenatedZipCodeAddress,
UnHyphenatedZipCodeAddress,
} from '../type/type';
import type { HyphenatedZipCode } from '../type/type';

export const goqZipCode = {
convertZipCode: function (testZipCode: string): string {
Expand Down Expand Up @@ -31,18 +28,8 @@ export const goqZipCode = {
},

convertHyphenatedZipCode: function (
hasOptionHyphen: boolean,
addresses: UnHyphenatedZipCodeAddress[]
): HyphenatedZipCodeAddress[] | UnHyphenatedZipCodeAddress[] {
if (hasOptionHyphen === false) {
return addresses;
}

return addresses.map((address) => {
return {
...address,
zipcode: `${address.zipcode.slice(0, 3)}-${address.zipcode.slice(3)}`,
};
});
zipCode: string | HyphenatedZipCode
): HyphenatedZipCode | string {
return `${zipCode.slice(0, 3)}-${zipCode.slice(3)}`;
},
};

0 comments on commit 0791deb

Please sign in to comment.