Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: susa 테스트 커버리지 보강 #299

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/susa/susa.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { hasProperty } from '../_internal';
import { SUSA_MAP, SUSA_CLASSIFIER_MAP } from './constants';
import { SUSA_CLASSIFIER_MAP, SUSA_MAP } from './constants';

/**
* 숫자를 순 우리말 수사로 변환합니다. 주어진 숫자가 0보다 크고 100 이하일 때 유효합니다.
Expand Down Expand Up @@ -52,14 +52,9 @@ function getClassifierWord(num: number): string {
return `${tensWord}${onesWord}`;
}

if (hasProperty(SUSA_MAP, ones)) {
const onesWord = SUSA_MAP[ones];
const onesWord = SUSA_MAP[ones as keyof typeof SUSA_MAP];

return `${tensWord}${onesWord}`;
}

// `susa`에서` `validateNumber` 하기 때문에 도달할 수 없는 분기입니다. 타입 추론을 위해 에러를 던져줍니다.
throw new Error('지원하지 않는 숫자입니다.');
return `${tensWord}${onesWord}`;
}

function validateNumber(num: number): void {
Expand Down