Skip to content

Commit

Permalink
chore(change method): 건물 검색 키워드를 포매팅할 때, replaceAll 메서드를 사용하는 것으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
hwinkr committed Dec 24, 2023
1 parent cea93ff commit eb89fdb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/map/get-building-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { BuildingType } from '@type/map';
const getBuildingInfo = (
keyword: string,
): [BuildingType, number] | undefined => {
const splittedKeyword = keyword.split(' ').join('').toUpperCase();
const formattedKeyword = keyword.replaceAll(' ', '').toUpperCase();

for (const buildingType of Object.keys(PKNU_BUILDINGS)) {
const index = PKNU_BUILDINGS[
buildingType as BuildingType
].buildings.findIndex(
(PKNU_BUILDING) =>
PKNU_BUILDING.buildingName === splittedKeyword ||
PKNU_BUILDING.buildingNumber === splittedKeyword,
PKNU_BUILDING.buildingName === formattedKeyword ||
PKNU_BUILDING.buildingNumber === formattedKeyword,
);
if (index !== -1) return [buildingType as BuildingType, index];
}
Expand Down

0 comments on commit eb89fdb

Please sign in to comment.