From 945a0bcf054a616783f0de71f82ae91e6e930712 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Thu, 16 Oct 2025 19:11:57 +0900 Subject: [PATCH 01/27] =?UTF-8?q?docs(README)=20:=20=EA=B8=B0=EB=8A=A5,=20?= =?UTF-8?q?=EC=9E=85=EB=A0=A5=EB=B0=A9=EC=8B=9D,=20=EC=98=88=EC=99=B8=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20=EB=AA=A9=EB=A1=9D=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 13420b29..42760791 100644 --- a/README.md +++ b/README.md @@ -1 +1,40 @@ -# javascript-calculator-precourse \ No newline at end of file +# javascript-calculator-precourse + +## 기능 + +- [ ] "덧셈할 문자열을 입력해 주세요." 출력 + +- [ ] 입력받기
+ 2-1. 입력값이 비어있을 경우 결과값 0 반환
+ 2-2. 입력값 형식이 잘못된 경우 예외 처리
+ 2-3. 입력값이 정상일 경우 다음 단계로 이동 +- [ ] 커스텀 구분자 사용 여부 확인
+ 3-1. 입력 문자열이 "//"로 시작할 경우 커스텀 구분자 추출
+ 3-2. 기본 구분자(쉼표, 콜론) + 커스텀 구분자를 구분자 배열에 추가 + +- [ ] 구분자(쉼표, 콜론, 커스텀 구분자)를 기준으로 문자열 분리 + +- [ ] 나뉜 문자열을 숫자 배열로 변환 (빈 문자열 제외)
+ 5-1. 음수 존재 시 예외 발생 ("음수는 허용되지 않습니다.")
+ 5-2. 숫자가 아닌 문자가 포함된 경우 예외 발생 + +- [ ] 숫자 배열의 모든 값을 합산 + +- [ ] "결과 : ${결과값}" 출력 + +- [ ] 프로그램 종료 + +## 입력방식 조건 + +정상 입력 형식은 다음 예시와 같다: + +- "1,2,3" → 쉼표(,) 구분 +- "1,2:3" → 쉼표(,)와 콜론(:) 혼용 +- "//;\n1;2;3" → 커스텀 구분자 세미콜론(;) +- "//;\n1;2:3" → 커스텀 구분자와 기본 구분자(:) 혼용 + +위의 형식을 제외한 모든 입력은 예외로 처리한다. + +## 예외 처리시 + +"[ERROR]"로 시작하는 메시지와 함께 Error를 발생시킨 후 애플리케이션은 종료되어야 한다. From 07a4e6d83556b656c82941511fcedcbfee951d0e Mon Sep 17 00:00:00 2001 From: TH_97 Date: Thu, 16 Oct 2025 20:22:51 +0900 Subject: [PATCH 02/27] =?UTF-8?q?feat(output):=20=EC=95=88=EB=82=B4?= =?UTF-8?q?=EB=AC=B8=EA=B5=AC=20=EC=B6=9C=EB=A0=A5=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - promptOutput 생성 - Console.print() 사용하여 안내문구 출력 --- src/App.js | 6 +++++- src/features/output/index.js | 1 + src/features/output/promptOutput/PromptOutput.js | 4 ++++ src/page/calculator/Calculator.js | 4 ++++ src/page/index.js | 1 + 5 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/features/output/index.js create mode 100644 src/features/output/promptOutput/PromptOutput.js create mode 100644 src/page/calculator/Calculator.js create mode 100644 src/page/index.js diff --git a/src/App.js b/src/App.js index 091aa0a5..03d3479a 100644 --- a/src/App.js +++ b/src/App.js @@ -1,5 +1,9 @@ +import { calculator } from "./page/index.js"; + class App { - async run() {} + async run() { + calculator(); + } } export default App; diff --git a/src/features/output/index.js b/src/features/output/index.js new file mode 100644 index 00000000..280ff8d2 --- /dev/null +++ b/src/features/output/index.js @@ -0,0 +1 @@ +export { promptOutput } from "./promptOutput/PromptOutput.js"; diff --git a/src/features/output/promptOutput/PromptOutput.js b/src/features/output/promptOutput/PromptOutput.js new file mode 100644 index 00000000..ba717035 --- /dev/null +++ b/src/features/output/promptOutput/PromptOutput.js @@ -0,0 +1,4 @@ +import { Console } from "@woowacourse/mission-utils"; +export async function promptOutput() { + Console.print("덧셈할 문자열을 입력해 주세요."); +} diff --git a/src/page/calculator/Calculator.js b/src/page/calculator/Calculator.js new file mode 100644 index 00000000..76ca70a6 --- /dev/null +++ b/src/page/calculator/Calculator.js @@ -0,0 +1,4 @@ +import { promptOutput } from "../../features/output/index.js"; +export function calculator() { + promptOutput(); +} diff --git a/src/page/index.js b/src/page/index.js new file mode 100644 index 00000000..737cdaf9 --- /dev/null +++ b/src/page/index.js @@ -0,0 +1 @@ +export { calculator } from "./Calculator/Calculator.js"; From e57541eb69fef9f862f5398e3c87a8315a48259b Mon Sep 17 00:00:00 2001 From: TH_97 Date: Thu, 16 Oct 2025 20:27:00 +0900 Subject: [PATCH 03/27] =?UTF-8?q?docs(README)=20:=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B2=B4=ED=81=AC=EB=B0=95=EC=8A=A4=20=EC=B2=B4=ED=81=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 42760791..d0f9abe5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## 기능 -- [ ] "덧셈할 문자열을 입력해 주세요." 출력 +- [x] "덧셈할 문자열을 입력해 주세요." 출력 - [ ] 입력받기
2-1. 입력값이 비어있을 경우 결과값 0 반환
From 0f3e343b4da3ed8906690744e6fd8fcd262a7e0e Mon Sep 17 00:00:00 2001 From: TH_97 Date: Thu, 16 Oct 2025 20:48:28 +0900 Subject: [PATCH 04/27] =?UTF-8?q?fix(import):=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EB=B0=8F=20=ED=8F=B4=EB=8D=94=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - camelCase로 통일하여 오류 방지 --- src/features/input/index.js | 1 + src/features/output/index.js | 2 +- src/page/index.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 src/features/input/index.js diff --git a/src/features/input/index.js b/src/features/input/index.js new file mode 100644 index 00000000..e5068841 --- /dev/null +++ b/src/features/input/index.js @@ -0,0 +1 @@ +export { inputReceiving } from "./inputReceiving/inputReceiving.js"; diff --git a/src/features/output/index.js b/src/features/output/index.js index 280ff8d2..0bc9e707 100644 --- a/src/features/output/index.js +++ b/src/features/output/index.js @@ -1 +1 @@ -export { promptOutput } from "./promptOutput/PromptOutput.js"; +export { promptOutput } from "./promptOutput/promptOutput.js"; diff --git a/src/page/index.js b/src/page/index.js index 737cdaf9..71f7f030 100644 --- a/src/page/index.js +++ b/src/page/index.js @@ -1 +1 @@ -export { calculator } from "./Calculator/Calculator.js"; +export { calculator } from "./calculator/calculator.js"; From fc823a0c684616d2d758c8acd75c41dcf3dc9a27 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Thu, 16 Oct 2025 20:49:21 +0900 Subject: [PATCH 05/27] =?UTF-8?q?docs(README)=20:=20=EB=A7=8C=EB=82=AC?= =?UTF-8?q?=EB=8D=98=20=EC=98=A4=EB=A5=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index d0f9abe5..ee8df276 100644 --- a/README.md +++ b/README.md @@ -38,3 +38,9 @@ ## 예외 처리시 "[ERROR]"로 시작하는 메시지와 함께 Error를 발생시킨 후 애플리케이션은 종료되어야 한다. + +## 만났던 오류 + +- 폴더 및 파일 이름 대소문자 불일치로 인한 import 오류
+ 파일명을 PromptOutput에서 promptOutput 변경하였습니다
이유는 FSD 환경에서는 PascalCase도 가능하지만, + 현재 프로젝트는 React/TypeScript 환경이 아니므로 camelCase로 통일 From 0b83dd906ce237f7ed26fa2bab092313dd929a9a Mon Sep 17 00:00:00 2001 From: TH_97 Date: Sat, 18 Oct 2025 19:19:25 +0900 Subject: [PATCH 06/27] =?UTF-8?q?docs(README)=20:=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=EC=9D=98=20=EC=9D=BC=EB=B6=80=20=EB=B6=80=EB=B6=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 기능 순서의 어색한 부분을 수정 --- README.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ee8df276..74ee106d 100644 --- a/README.md +++ b/README.md @@ -5,18 +5,22 @@ - [x] "덧셈할 문자열을 입력해 주세요." 출력 - [ ] 입력받기
- 2-1. 입력값이 비어있을 경우 결과값 0 반환
- 2-2. 입력값 형식이 잘못된 경우 예외 처리
- 2-3. 입력값이 정상일 경우 다음 단계로 이동 + ~~2-1. 입력값이 비어있을 경우 결과값 0 반환~~
+ ~~2-2. 입력값 형식이 잘못된 경우 예외 처리~~
+ ~~2-3. 입력값이 정상일 경우 다음 단계로 이동~~ - [ ] 커스텀 구분자 사용 여부 확인
- 3-1. 입력 문자열이 "//"로 시작할 경우 커스텀 구분자 추출
- 3-2. 기본 구분자(쉼표, 콜론) + 커스텀 구분자를 구분자 배열에 추가 + 1-1 입력 문자열이 "//"로 시작하고 "\n"끝났을 경우 커스텀 구분자 추출
+ 1-2. 커스텀 구분자를 구분자 배열에 추가 + 1-3. 커스텀 구분자가 존재하지 않을시 기본구분자 사용 여부 확인 + +- [ ] 기본 구분자 사용 여부 확인
+ 1-1. 기본 구분자 마저 존재하지 않을시 예외 발생 - [ ] 구분자(쉼표, 콜론, 커스텀 구분자)를 기준으로 문자열 분리 - [ ] 나뉜 문자열을 숫자 배열로 변환 (빈 문자열 제외)
- 5-1. 음수 존재 시 예외 발생 ("음수는 허용되지 않습니다.")
- 5-2. 숫자가 아닌 문자가 포함된 경우 예외 발생 + ~~5-1. 음수 존재 시 예외 발생 ("음수는 허용되지 않습니다.")~~
+ 5-1. 숫자가 아닌 문자가 포함된 경우 예외 발생 - [ ] 숫자 배열의 모든 값을 합산 From ed90bf41bd20280cee2c0f339fe1c2d9c5ae47c1 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Sat, 18 Oct 2025 19:22:27 +0900 Subject: [PATCH 07/27] =?UTF-8?q?feat(input):=20=EC=9E=85=EB=A0=A5?= =?UTF-8?q?=EB=B0=9B=EA=B8=B0=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/input/index.js | 2 +- src/features/input/readInput/readInput.js | 6 ++++++ src/page/calculator/Calculator.js | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 src/features/input/readInput/readInput.js diff --git a/src/features/input/index.js b/src/features/input/index.js index e5068841..85e6195b 100644 --- a/src/features/input/index.js +++ b/src/features/input/index.js @@ -1 +1 @@ -export { inputReceiving } from "./inputReceiving/inputReceiving.js"; +export { readInput } from "./readInput/readInput.js"; diff --git a/src/features/input/readInput/readInput.js b/src/features/input/readInput/readInput.js new file mode 100644 index 00000000..b0db3c36 --- /dev/null +++ b/src/features/input/readInput/readInput.js @@ -0,0 +1,6 @@ +import { Console } from "@woowacourse/mission-utils"; + +export async function readInput() { + const input = await Console.readLineAsync(""); + return input; +} diff --git a/src/page/calculator/Calculator.js b/src/page/calculator/Calculator.js index 76ca70a6..4196b5de 100644 --- a/src/page/calculator/Calculator.js +++ b/src/page/calculator/Calculator.js @@ -1,4 +1,6 @@ +import { readInput } from "../../features/input/index.js"; import { promptOutput } from "../../features/output/index.js"; export function calculator() { promptOutput(); + readInput(); } From ebe704cbd4ca611c657fe5a98a75d7d2be66ccc1 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Sat, 18 Oct 2025 19:22:59 +0900 Subject: [PATCH 08/27] =?UTF-8?q?docs(README)=20:=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B2=B4=ED=81=AC=EB=B0=95=EC=8A=A4=20=EC=B2=B4=ED=81=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 74ee106d..18afc0c6 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ - [x] "덧셈할 문자열을 입력해 주세요." 출력 -- [ ] 입력받기
+- [x] 입력받기
~~2-1. 입력값이 비어있을 경우 결과값 0 반환~~
~~2-2. 입력값 형식이 잘못된 경우 예외 처리~~
~~2-3. 입력값이 정상일 경우 다음 단계로 이동~~ From ecdf11bffdbca22282cedd6b779dd5779d57a924 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Sat, 18 Oct 2025 19:44:58 +0900 Subject: [PATCH 09/27] =?UTF-8?q?docs(README)=20:=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=EC=9D=98=20=EC=9D=BC=EB=B6=80=20=EB=B6=80=EB=B6=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 입력값이 비었을 경우의 처리 기능 추가 - 커스텀 구분자 사용 여부 기능의 잘못된 부분 삭제 --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 18afc0c6..c9c92a01 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,12 @@ ~~2-1. 입력값이 비어있을 경우 결과값 0 반환~~
~~2-2. 입력값 형식이 잘못된 경우 예외 처리~~
~~2-3. 입력값이 정상일 경우 다음 단계로 이동~~ + +- [ ] 입력값이 비었을 경우 결과값 0으로 처리 - [ ] 커스텀 구분자 사용 여부 확인
1-1 입력 문자열이 "//"로 시작하고 "\n"끝났을 경우 커스텀 구분자 추출
1-2. 커스텀 구분자를 구분자 배열에 추가 - 1-3. 커스텀 구분자가 존재하지 않을시 기본구분자 사용 여부 확인 + ~~1-3. 커스텀 구분자가 존재하지 않을시 기본구분자 사용 여부 확인~~ - [ ] 기본 구분자 사용 여부 확인
1-1. 기본 구분자 마저 존재하지 않을시 예외 발생 From e45f07c06aa18ec682cf5b35ffe7ece2ef37c5ff Mon Sep 17 00:00:00 2001 From: TH_97 Date: Sat, 18 Oct 2025 20:27:21 +0900 Subject: [PATCH 10/27] =?UTF-8?q?feat(output):=20=EC=9E=85=EB=A0=A5?= =?UTF-8?q?=EA=B0=92=EC=9D=B4=20=EB=B9=84=EC=97=88=EC=9D=84=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 검증하는 과정에서 입력값이 비었을 경우 결과 값을 0 출력하는 기능 --- src/features/output/index.js | 1 + .../outputValidationError.js | 7 +++++++ src/features/validate/index.js | 1 + .../validateInput/lib/checkEmptyInput.js | 4 ++++ .../validate/validateInput/validateInput.js | 5 +++++ src/page/calculator/Calculator.js | 17 +++++++++++++---- 6 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 src/features/output/outputValidationError/outputValidationError.js create mode 100644 src/features/validate/index.js create mode 100644 src/features/validate/validateInput/lib/checkEmptyInput.js create mode 100644 src/features/validate/validateInput/validateInput.js diff --git a/src/features/output/index.js b/src/features/output/index.js index 0bc9e707..657365bb 100644 --- a/src/features/output/index.js +++ b/src/features/output/index.js @@ -1 +1,2 @@ export { promptOutput } from "./promptOutput/promptOutput.js"; +export { outputValidationError } from "./outputValidationError/outputValidationError.js"; diff --git a/src/features/output/outputValidationError/outputValidationError.js b/src/features/output/outputValidationError/outputValidationError.js new file mode 100644 index 00000000..a20c85b4 --- /dev/null +++ b/src/features/output/outputValidationError/outputValidationError.js @@ -0,0 +1,7 @@ +import { Console } from "@woowacourse/mission-utils"; + +export function outputValidationError(reason) { + if (reason === "empty") { + Console.print("결과값 : 0"); + } +} diff --git a/src/features/validate/index.js b/src/features/validate/index.js new file mode 100644 index 00000000..c0f1d98f --- /dev/null +++ b/src/features/validate/index.js @@ -0,0 +1 @@ +export { vaildateInput } from "./validateInput/validateInput.js"; diff --git a/src/features/validate/validateInput/lib/checkEmptyInput.js b/src/features/validate/validateInput/lib/checkEmptyInput.js new file mode 100644 index 00000000..4a33f949 --- /dev/null +++ b/src/features/validate/validateInput/lib/checkEmptyInput.js @@ -0,0 +1,4 @@ +export function checkEmptyInput(input) { + if (input === "") return false; + return true; +} diff --git a/src/features/validate/validateInput/validateInput.js b/src/features/validate/validateInput/validateInput.js new file mode 100644 index 00000000..f0514f36 --- /dev/null +++ b/src/features/validate/validateInput/validateInput.js @@ -0,0 +1,5 @@ +import { checkEmptyInput } from "./lib/checkEmptyInput.js"; + +export function vaildateInput(input) { + if (!checkEmptyInput(input)) return { isValid: false, reason: "empty" }; +} diff --git a/src/page/calculator/Calculator.js b/src/page/calculator/Calculator.js index 4196b5de..d514e062 100644 --- a/src/page/calculator/Calculator.js +++ b/src/page/calculator/Calculator.js @@ -1,6 +1,15 @@ import { readInput } from "../../features/input/index.js"; -import { promptOutput } from "../../features/output/index.js"; -export function calculator() { - promptOutput(); - readInput(); +import { + promptOutput, + outputValidationError, +} from "../../features/output/index.js"; +import { vaildateInput } from "../../features/validate/index.js"; +export async function calculator() { + await promptOutput(); + const input = await readInput(); + if (!vaildateInput(input).isValid) { + const reason = vaildateInput(input).reason; + outputValidationError(reason); + return; + } } From 74c234f3fe9d5e6b033a288127b86b739692d232 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Sat, 18 Oct 2025 20:27:54 +0900 Subject: [PATCH 11/27] =?UTF-8?q?docs(README)=20:=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B2=B4=ED=81=AC=EB=B0=95=EC=8A=A4=20=EC=B2=B4=ED=81=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c9c92a01..46abefd8 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ ~~2-2. 입력값 형식이 잘못된 경우 예외 처리~~
~~2-3. 입력값이 정상일 경우 다음 단계로 이동~~ -- [ ] 입력값이 비었을 경우 결과값 0으로 처리 +- [x] 입력값이 비었을 경우 결과값 0으로 처리 - [ ] 커스텀 구분자 사용 여부 확인
1-1 입력 문자열이 "//"로 시작하고 "\n"끝났을 경우 커스텀 구분자 추출
1-2. 커스텀 구분자를 구분자 배열에 추가 From b2f3a01974585bc107406db5abed71a5388f24ee Mon Sep 17 00:00:00 2001 From: TH_97 Date: Sun, 19 Oct 2025 17:17:16 +0900 Subject: [PATCH 12/27] =?UTF-8?q?docs(README)=20:=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 입력값 검증기능 수정 - 구분자 사용시로 변경 --- README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 46abefd8..a9f1fd5b 100644 --- a/README.md +++ b/README.md @@ -9,20 +9,21 @@ ~~2-2. 입력값 형식이 잘못된 경우 예외 처리~~
~~2-3. 입력값이 정상일 경우 다음 단계로 이동~~ -- [x] 입력값이 비었을 경우 결과값 0으로 처리 -- [ ] 커스텀 구분자 사용 여부 확인
+- [x] 입력값 검증
+ 1-1. 입력값이 비었을 경우 결과값 0으로 처리
+ 1-2. 입력값 검증 +- [ ] 커스텀 구분자 사용시
1-1 입력 문자열이 "//"로 시작하고 "\n"끝났을 경우 커스텀 구분자 추출
1-2. 커스텀 구분자를 구분자 배열에 추가 - ~~1-3. 커스텀 구분자가 존재하지 않을시 기본구분자 사용 여부 확인~~ + 1-3. 커스텀 구분자가 존재하지 않을시 기본구분자 사용 -- [ ] 기본 구분자 사용 여부 확인
+- [ ] 기본 구분자 사용 시
1-1. 기본 구분자 마저 존재하지 않을시 예외 발생 - -- [ ] 구분자(쉼표, 콜론, 커스텀 구분자)를 기준으로 문자열 분리 + 1-2. 구분자(쉼표, 콜론, 커스텀 구분자)를 기준으로 분리 - [ ] 나뉜 문자열을 숫자 배열로 변환 (빈 문자열 제외)
~~5-1. 음수 존재 시 예외 발생 ("음수는 허용되지 않습니다.")~~
- 5-1. 숫자가 아닌 문자가 포함된 경우 예외 발생 + 1-1. 숫자가 아닌 문자가 포함된 경우 예외 발생 - [ ] 숫자 배열의 모든 값을 합산 From b2204a54ee2d7eb21d7a058b09d2010a82bb08f1 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Mon, 20 Oct 2025 04:09:01 +0900 Subject: [PATCH 13/27] =?UTF-8?q?docs(README)=20:=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 입력값 검증 일부 제거 --- README.md | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index a9f1fd5b..4e02a559 100644 --- a/README.md +++ b/README.md @@ -4,26 +4,28 @@ - [x] "덧셈할 문자열을 입력해 주세요." 출력 -- [x] 입력받기
- ~~2-1. 입력값이 비어있을 경우 결과값 0 반환~~
- ~~2-2. 입력값 형식이 잘못된 경우 예외 처리~~
- ~~2-3. 입력값이 정상일 경우 다음 단계로 이동~~ - -- [x] 입력값 검증
- 1-1. 입력값이 비었을 경우 결과값 0으로 처리
- 1-2. 입력값 검증 -- [ ] 커스텀 구분자 사용시
- 1-1 입력 문자열이 "//"로 시작하고 "\n"끝났을 경우 커스텀 구분자 추출
- 1-2. 커스텀 구분자를 구분자 배열에 추가 - 1-3. 커스텀 구분자가 존재하지 않을시 기본구분자 사용 - -- [ ] 기본 구분자 사용 시
- 1-1. 기본 구분자 마저 존재하지 않을시 예외 발생 - 1-2. 구분자(쉼표, 콜론, 커스텀 구분자)를 기준으로 분리 - -- [ ] 나뉜 문자열을 숫자 배열로 변환 (빈 문자열 제외)
- ~~5-1. 음수 존재 시 예외 발생 ("음수는 허용되지 않습니다.")~~
- 1-1. 숫자가 아닌 문자가 포함된 경우 예외 발생 +- [x] 입력받기 + +- [x] 입력값이 0인지 확인 + + 입력값이 비었을 경우 결과값 0으로 처리 + +- [ ] 커스텀 구분자 사용시 + + 1. 커스텀 시작 구분자("//"), 커스텀 종료 구분자("\n")가 잘못 표기시에 예외상황 발생 + 2. 입력 문자열이 "//"로 시작하고 "\n"끝났을 경우 커스텀 구분자 추출 + 3. 커스텀 구분자를 구분자 배열에 추가 + 4. 커스텀 구분자가 존재하지 않을시 기본구분자 사용 + +- [ ] 기본 구분자 사용 시 + + 1. 구분자(쉼표, 콜론, 커스텀 구분자)가 잘못 표기시에 예외상황 발생 + 2. 기본 구분자 마저 존재하지 않을시 예외 발생 + 3. 구분자(쉼표, 콜론, 커스텀 구분자)를 기준으로 분리 + +- [ ] 나뉜 문자열을 숫자 배열로 변환 (빈 문자열 제외) + + 숫자가 아닌 문자가 포함된 경우 예외 발생 - [ ] 숫자 배열의 모든 값을 합산 From 377c1f878175d1b6a096c86602a07651372fc990 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Mon, 20 Oct 2025 04:56:42 +0900 Subject: [PATCH 14/27] =?UTF-8?q?fix(features)=20:=20=EC=9E=85=EB=A0=A5?= =?UTF-8?q?=EA=B0=92=EC=9D=B4=20=EB=B9=84=EC=97=88=EC=9D=84=EC=8B=9C=20?= =?UTF-8?q?=EA=B2=B0=EA=B3=BC=EA=B0=92=20=20=EC=B6=9C=EB=A0=A5=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 재사용성을 위해 resultOuput 생성 - checkEmptyInput 파일 이름 변경 - calculator 코드 단순화 --- src/features/output/index.js | 2 +- .../outputValidationError/outputValidationError.js | 7 ------- src/features/output/resultOutput/resultOutput.js | 5 +++++ .../validate/validateInput/lib/checkEmptyInput.js | 4 ---- src/features/validate/validateInput/lib/isEmpty.js | 4 ++++ src/features/validate/validateInput/validateInput.js | 5 +++-- src/page/calculator/Calculator.js | 10 +++------- 7 files changed, 16 insertions(+), 21 deletions(-) delete mode 100644 src/features/output/outputValidationError/outputValidationError.js create mode 100644 src/features/output/resultOutput/resultOutput.js delete mode 100644 src/features/validate/validateInput/lib/checkEmptyInput.js create mode 100644 src/features/validate/validateInput/lib/isEmpty.js diff --git a/src/features/output/index.js b/src/features/output/index.js index 657365bb..3210d1ac 100644 --- a/src/features/output/index.js +++ b/src/features/output/index.js @@ -1,2 +1,2 @@ export { promptOutput } from "./promptOutput/promptOutput.js"; -export { outputValidationError } from "./outputValidationError/outputValidationError.js"; +export { resultOutput } from "./resultOutput/resultOutput.js"; diff --git a/src/features/output/outputValidationError/outputValidationError.js b/src/features/output/outputValidationError/outputValidationError.js deleted file mode 100644 index a20c85b4..00000000 --- a/src/features/output/outputValidationError/outputValidationError.js +++ /dev/null @@ -1,7 +0,0 @@ -import { Console } from "@woowacourse/mission-utils"; - -export function outputValidationError(reason) { - if (reason === "empty") { - Console.print("결과값 : 0"); - } -} diff --git a/src/features/output/resultOutput/resultOutput.js b/src/features/output/resultOutput/resultOutput.js new file mode 100644 index 00000000..09904289 --- /dev/null +++ b/src/features/output/resultOutput/resultOutput.js @@ -0,0 +1,5 @@ +import { Console } from "@woowacourse/mission-utils"; + +export function resultOutput(sum) { + Console.print(`결과 : ${sum}`); +} diff --git a/src/features/validate/validateInput/lib/checkEmptyInput.js b/src/features/validate/validateInput/lib/checkEmptyInput.js deleted file mode 100644 index 4a33f949..00000000 --- a/src/features/validate/validateInput/lib/checkEmptyInput.js +++ /dev/null @@ -1,4 +0,0 @@ -export function checkEmptyInput(input) { - if (input === "") return false; - return true; -} diff --git a/src/features/validate/validateInput/lib/isEmpty.js b/src/features/validate/validateInput/lib/isEmpty.js new file mode 100644 index 00000000..38abc899 --- /dev/null +++ b/src/features/validate/validateInput/lib/isEmpty.js @@ -0,0 +1,4 @@ +export function isEmpty(input) { + if (input.trim() === "") return true; + return false; +} diff --git a/src/features/validate/validateInput/validateInput.js b/src/features/validate/validateInput/validateInput.js index f0514f36..ac696538 100644 --- a/src/features/validate/validateInput/validateInput.js +++ b/src/features/validate/validateInput/validateInput.js @@ -1,5 +1,6 @@ -import { checkEmptyInput } from "./lib/checkEmptyInput.js"; +import { isEmpty } from "./lib/isEmpty.js"; export function vaildateInput(input) { - if (!checkEmptyInput(input)) return { isValid: false, reason: "empty" }; + if (isEmpty(input)) return false; + return true; } diff --git a/src/page/calculator/Calculator.js b/src/page/calculator/Calculator.js index d514e062..0f6d0d4c 100644 --- a/src/page/calculator/Calculator.js +++ b/src/page/calculator/Calculator.js @@ -1,15 +1,11 @@ import { readInput } from "../../features/input/index.js"; -import { - promptOutput, - outputValidationError, -} from "../../features/output/index.js"; +import { promptOutput, resultOutput } from "../../features/output/index.js"; import { vaildateInput } from "../../features/validate/index.js"; export async function calculator() { await promptOutput(); const input = await readInput(); - if (!vaildateInput(input).isValid) { - const reason = vaildateInput(input).reason; - outputValidationError(reason); + if (!vaildateInput(input)) { + resultOutput(0); return; } } From 2355557a92a37ae14c96699f0d62527dc636568f Mon Sep 17 00:00:00 2001 From: TH_97 Date: Mon, 20 Oct 2025 22:43:43 +0900 Subject: [PATCH 15/27] =?UTF-8?q?feat(deliniter)=20:=20deliniter=20?= =?UTF-8?q?=EB=AA=A8=EB=8D=B8=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/delimiter/index.js | 1 + src/entities/delimiter/model/delimiters.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/entities/delimiter/index.js create mode 100644 src/entities/delimiter/model/delimiters.js diff --git a/src/entities/delimiter/index.js b/src/entities/delimiter/index.js new file mode 100644 index 00000000..fb768c8e --- /dev/null +++ b/src/entities/delimiter/index.js @@ -0,0 +1 @@ +export { Delimiters } from "./model/delimiters.js"; diff --git a/src/entities/delimiter/model/delimiters.js b/src/entities/delimiter/model/delimiters.js new file mode 100644 index 00000000..3eb50d64 --- /dev/null +++ b/src/entities/delimiter/model/delimiters.js @@ -0,0 +1,15 @@ +export class Delimiters { + constructor() { + this.delimiterArray = [",", ":"]; + } + + addCustumDelimiter(elimiter) { + if (!this.delimiterArray.includes(elimiter)) { + this.delimiterArray.push(elimiter); + } + } + + getDelimiterArray() { + return this.delimiterArray; + } +} From 2d316224e311c97fa351428c0d80626d01858067 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Mon, 20 Oct 2025 22:44:09 +0900 Subject: [PATCH 16/27] =?UTF-8?q?feat(number)=20:=20number=20=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/number/index.js | 1 + src/entities/number/model/numberArray.js | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/entities/number/index.js create mode 100644 src/entities/number/model/numberArray.js diff --git a/src/entities/number/index.js b/src/entities/number/index.js new file mode 100644 index 00000000..b3d8207b --- /dev/null +++ b/src/entities/number/index.js @@ -0,0 +1 @@ +export { NumberArray } from "./model/numberArray.js"; diff --git a/src/entities/number/model/numberArray.js b/src/entities/number/model/numberArray.js new file mode 100644 index 00000000..3117e84b --- /dev/null +++ b/src/entities/number/model/numberArray.js @@ -0,0 +1,23 @@ +export class NumberArray { + constructor() { + this.numberArray = []; + } + + isNumber(number) { + return Number.isInteger(Number(number)); + } + + addNumber(number) { + this.numberArray.push(Number(number)); + } + + getArray() { + return this.numberArray; + } + getSum() { + return this.numberArray.reduce( + (acc, curr) => Number(acc) + Number(curr), + 0 + ); + } +} From 564166f314b2a0fe4ee033fab7335a5cf854f725 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Mon, 20 Oct 2025 22:44:51 +0900 Subject: [PATCH 17/27] =?UTF-8?q?feat(error)=20:=20error=EC=8B=9C=20?= =?UTF-8?q?=EB=8F=99=EC=9E=91=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shared/error/customError/customError.js | 3 +++ src/shared/error/delimiterError/delimiterError.js | 3 +++ src/shared/error/index.js | 3 +++ src/shared/error/numberError/numberError.js | 3 +++ 4 files changed, 12 insertions(+) create mode 100644 src/shared/error/customError/customError.js create mode 100644 src/shared/error/delimiterError/delimiterError.js create mode 100644 src/shared/error/index.js create mode 100644 src/shared/error/numberError/numberError.js diff --git a/src/shared/error/customError/customError.js b/src/shared/error/customError/customError.js new file mode 100644 index 00000000..4da30a1a --- /dev/null +++ b/src/shared/error/customError/customError.js @@ -0,0 +1,3 @@ +export function customError() { + throw new Error("[Error] : 커스텀 구분자 생성 실패"); +} diff --git a/src/shared/error/delimiterError/delimiterError.js b/src/shared/error/delimiterError/delimiterError.js new file mode 100644 index 00000000..f366fd1a --- /dev/null +++ b/src/shared/error/delimiterError/delimiterError.js @@ -0,0 +1,3 @@ +export function delimiterError() { + throw new Error("[Error] : 구분자는 쉼표(,) , 콜론(:) , 커스텀 입니다"); +} diff --git a/src/shared/error/index.js b/src/shared/error/index.js new file mode 100644 index 00000000..72e95286 --- /dev/null +++ b/src/shared/error/index.js @@ -0,0 +1,3 @@ +export { customError } from "./customError/customError.js"; +export { delimiterError } from "./delimiterError/delimiterError.js"; +export { numberError } from "./numberError/numberError.js"; diff --git a/src/shared/error/numberError/numberError.js b/src/shared/error/numberError/numberError.js new file mode 100644 index 00000000..d34934ef --- /dev/null +++ b/src/shared/error/numberError/numberError.js @@ -0,0 +1,3 @@ +export function numberError() { + throw new Error("[ERROR] : 정수만 입력 가능합니다"); +} From b7e5fb18e769dfdf768a73fc703295f5d44acf6a Mon Sep 17 00:00:00 2001 From: TH_97 Date: Mon, 20 Oct 2025 22:46:20 +0900 Subject: [PATCH 18/27] =?UTF-8?q?feat(sumNumer)=20:=20=EC=9E=85=EB=A0=A5?= =?UTF-8?q?=EA=B0=92=EC=9D=84=20=ED=95=A9=EC=B9=98=EB=8A=94=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - number 모델을 이용해서 배열에 있는 숫자 합치기 --- src/features/sumNumber/index.js | 1 + src/features/sumNumber/sumNumber/sumNumber.js | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 src/features/sumNumber/index.js create mode 100644 src/features/sumNumber/sumNumber/sumNumber.js diff --git a/src/features/sumNumber/index.js b/src/features/sumNumber/index.js new file mode 100644 index 00000000..9d9b99d9 --- /dev/null +++ b/src/features/sumNumber/index.js @@ -0,0 +1 @@ +export { sumNumber } from "./sumNumber/sumNumber.js"; diff --git a/src/features/sumNumber/sumNumber/sumNumber.js b/src/features/sumNumber/sumNumber/sumNumber.js new file mode 100644 index 00000000..87057428 --- /dev/null +++ b/src/features/sumNumber/sumNumber/sumNumber.js @@ -0,0 +1,11 @@ +import { NumberArray } from "../../../entities/number/index.js"; +import { numberError } from "../../../shared/error/index.js"; + +export function sumNumber(numberArray) { + const array = new NumberArray(); + numberArray.forEach((number) => { + if (!array.isNumber(number)) numberError(); + array.addNumber(number); + }); + return array.getSum(); +} From a47661597004d8b69e30dcdf5e794507846efdf2 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Mon, 20 Oct 2025 22:46:58 +0900 Subject: [PATCH 19/27] =?UTF-8?q?feat(splitInput)=20:=20=EC=9E=85=EB=A0=A5?= =?UTF-8?q?=EA=B0=92=20=EA=B5=AC=EB=B6=84=EC=9E=90=20=EA=B8=B0=EC=A4=80?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=82=98=EB=88=84=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/splitInput/index.js | 1 + src/features/splitInput/splitInput/splitInput.js | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 src/features/splitInput/index.js create mode 100644 src/features/splitInput/splitInput/splitInput.js diff --git a/src/features/splitInput/index.js b/src/features/splitInput/index.js new file mode 100644 index 00000000..97888684 --- /dev/null +++ b/src/features/splitInput/index.js @@ -0,0 +1 @@ +export { splitInput } from "./splitInput/splitInput.js"; diff --git a/src/features/splitInput/splitInput/splitInput.js b/src/features/splitInput/splitInput/splitInput.js new file mode 100644 index 00000000..67b4d128 --- /dev/null +++ b/src/features/splitInput/splitInput/splitInput.js @@ -0,0 +1,11 @@ +import { delimiterError } from "../../../shared/error/index.js"; + +export function splitInput(input, delimiterArray) { + if (!delimiterArray.some((delimiter) => input.includes(delimiter))) { + delimiterError(); + } + for (const delimiter of delimiterArray) { + input = input.replaceAll(delimiter, " "); + } + return input.split(" "); +} From a85a13a0757cb62fd4d40bd8bf3939cacb425a03 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Mon, 20 Oct 2025 22:47:36 +0900 Subject: [PATCH 20/27] =?UTF-8?q?fix=20(checkDelimiter)=20:=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/checkDelimiter/index.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/features/checkDelimiter/index.js diff --git a/src/features/checkDelimiter/index.js b/src/features/checkDelimiter/index.js new file mode 100644 index 00000000..a606e809 --- /dev/null +++ b/src/features/checkDelimiter/index.js @@ -0,0 +1 @@ +export { parseCustomDelimiter } from "./parseCustomDelimiter/parseCustomDelimiter.js"; From 5d6d41dd448280943216865171a041ad31c324f9 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Mon, 20 Oct 2025 22:48:03 +0900 Subject: [PATCH 21/27] =?UTF-8?q?fix(parseCustomDelimiter)=20:=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EB=AA=85=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../parseCustomDelimiter.js | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/features/checkDelimiter/parseCustomDelimiter/parseCustomDelimiter.js diff --git a/src/features/checkDelimiter/parseCustomDelimiter/parseCustomDelimiter.js b/src/features/checkDelimiter/parseCustomDelimiter/parseCustomDelimiter.js new file mode 100644 index 00000000..347adcf2 --- /dev/null +++ b/src/features/checkDelimiter/parseCustomDelimiter/parseCustomDelimiter.js @@ -0,0 +1,28 @@ +import { Delimiters } from "../../../entities/delimiter/index.js"; +import { customError } from "../../../shared/error/index.js"; + +export function parseCustomDelimiter(input) { + const startMarker = input.indexOf("//"); + const endMarker = input.indexOf("\\n"); + + const delimiterManager = new Delimiters(); + let inputString = input; + + if ( + (startMarker === -1 && endMarker !== -1) || + (startMarker === 0 && endMarker === -1) + ) { + customError(); + } + + if (startMarker === 0 && endMarker !== -1) { + const customDelimiter = input.slice(startMarker + 2, endMarker); + delimiterManager.addCustumDelimiter(customDelimiter); + inputString = input.slice(endMarker + 2); + } + + return { + DelimiterArray: delimiterManager.getDelimiterArray(), + Input: inputString, + }; +} From 35ac877130376c7d7df68c73971f1f56f83636ad Mon Sep 17 00:00:00 2001 From: TH_97 Date: Mon, 20 Oct 2025 22:48:33 +0900 Subject: [PATCH 22/27] =?UTF-8?q?feat(calculator)=20:=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=EB=90=9C=20=EA=B8=B0=EB=8A=A5=EC=97=90=20=EC=9D=98=ED=95=B4=20?= =?UTF-8?q?=ED=98=B8=EC=B6=9C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/calculator/Calculator.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/page/calculator/Calculator.js b/src/page/calculator/Calculator.js index 0f6d0d4c..4858ce2a 100644 --- a/src/page/calculator/Calculator.js +++ b/src/page/calculator/Calculator.js @@ -1,5 +1,8 @@ +import { parseCustomDelimiter } from "../../features/checkDelimiter/index.js"; import { readInput } from "../../features/input/index.js"; import { promptOutput, resultOutput } from "../../features/output/index.js"; +import { splitInput } from "../../features/splitInput/index.js"; +import { sumNumber } from "../../features/sumNumber/index.js"; import { vaildateInput } from "../../features/validate/index.js"; export async function calculator() { await promptOutput(); @@ -8,4 +11,14 @@ export async function calculator() { resultOutput(0); return; } + const parsedInput = parseCustomDelimiter(input); + + const numbers = await splitInput( + parsedInput.Input, + parsedInput.DelimiterArray + ); + + const result = await sumNumber(numbers); + resultOutput(result); + return; } From cc23dd3b265a63c4389eed58f0419bc338f63504 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Mon, 20 Oct 2025 23:21:48 +0900 Subject: [PATCH 23/27] =?UTF-8?q?fix(App)=20:=20=ED=98=B8=EC=B6=9C?= =?UTF-8?q?=EC=8B=9C=20await=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App.js b/src/App.js index 03d3479a..ce8eab95 100644 --- a/src/App.js +++ b/src/App.js @@ -2,7 +2,7 @@ import { calculator } from "./page/index.js"; class App { async run() { - calculator(); + await calculator(); } } From 23f1b9d0257714b7df659bb1e0f77b3bab85f016 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Mon, 20 Oct 2025 23:22:26 +0900 Subject: [PATCH 24/27] =?UTF-8?q?feat=20(number)=20:=20=EC=9D=8C=EC=88=98?= =?UTF-8?q?=20=EB=B6=88=EA=B0=80=EB=8A=A5=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/number/model/numberArray.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/number/model/numberArray.js b/src/entities/number/model/numberArray.js index 3117e84b..b2fa100a 100644 --- a/src/entities/number/model/numberArray.js +++ b/src/entities/number/model/numberArray.js @@ -4,7 +4,7 @@ export class NumberArray { } isNumber(number) { - return Number.isInteger(Number(number)); + return Number.isInteger(Number(number)) && Number(number) >= 0; } addNumber(number) { From 3c8edd75dc0a8c9b330f15a32bdb12c418563ade Mon Sep 17 00:00:00 2001 From: TH_97 Date: Mon, 20 Oct 2025 23:23:03 +0900 Subject: [PATCH 25/27] =?UTF-8?q?fix(parseCustomDelimiter)=20:=20jest=20te?= =?UTF-8?q?st=EC=9D=98=20=EA=B8=B0=EC=A4=80=EC=97=90=20=EB=A7=9E=EC=B6=B0?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../checkDelimiter/parseCustomDelimiter/parseCustomDelimiter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/checkDelimiter/parseCustomDelimiter/parseCustomDelimiter.js b/src/features/checkDelimiter/parseCustomDelimiter/parseCustomDelimiter.js index 347adcf2..35bb930d 100644 --- a/src/features/checkDelimiter/parseCustomDelimiter/parseCustomDelimiter.js +++ b/src/features/checkDelimiter/parseCustomDelimiter/parseCustomDelimiter.js @@ -16,7 +16,7 @@ export function parseCustomDelimiter(input) { } if (startMarker === 0 && endMarker !== -1) { - const customDelimiter = input.slice(startMarker + 2, endMarker); + const customDelimiter = input.slice(startMarker + 2, endMarker - 1); delimiterManager.addCustumDelimiter(customDelimiter); inputString = input.slice(endMarker + 2); } From 3ecc5d6e89fa045984a525c2a9f67041afe5f331 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Mon, 20 Oct 2025 23:24:02 +0900 Subject: [PATCH 26/27] =?UTF-8?q?ocs(README)=20:=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B2=B4=ED=81=AC=EB=B0=95=EC=8A=A4=20=EC=B2=B4=ED=81=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4e02a559..319f98c3 100644 --- a/README.md +++ b/README.md @@ -10,28 +10,28 @@ 입력값이 비었을 경우 결과값 0으로 처리 -- [ ] 커스텀 구분자 사용시 +- [x] 커스텀 구분자 사용시 1. 커스텀 시작 구분자("//"), 커스텀 종료 구분자("\n")가 잘못 표기시에 예외상황 발생 2. 입력 문자열이 "//"로 시작하고 "\n"끝났을 경우 커스텀 구분자 추출 3. 커스텀 구분자를 구분자 배열에 추가 4. 커스텀 구분자가 존재하지 않을시 기본구분자 사용 -- [ ] 기본 구분자 사용 시 +- [x] 기본 구분자 사용 시 1. 구분자(쉼표, 콜론, 커스텀 구분자)가 잘못 표기시에 예외상황 발생 2. 기본 구분자 마저 존재하지 않을시 예외 발생 3. 구분자(쉼표, 콜론, 커스텀 구분자)를 기준으로 분리 -- [ ] 나뉜 문자열을 숫자 배열로 변환 (빈 문자열 제외) +- [x] 나뉜 문자열을 숫자 배열로 변환 (빈 문자열 제외) 숫자가 아닌 문자가 포함된 경우 예외 발생 -- [ ] 숫자 배열의 모든 값을 합산 +- [x] 숫자 배열의 모든 값을 합산 -- [ ] "결과 : ${결과값}" 출력 +- [x] "결과 : ${결과값}" 출력 -- [ ] 프로그램 종료 +- [x] 프로그램 종료 ## 입력방식 조건 From 4234e41c9ff3d184c5660ada88fd214af202a6c1 Mon Sep 17 00:00:00 2001 From: TH_97 Date: Mon, 20 Oct 2025 23:27:22 +0900 Subject: [PATCH 27/27] =?UTF-8?q?docs(README)=20:=20=EC=95=84=EC=89=AC?= =?UTF-8?q?=EC=9A=B4=EC=A0=90=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 319f98c3..1841bd66 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,9 @@ - 폴더 및 파일 이름 대소문자 불일치로 인한 import 오류
파일명을 PromptOutput에서 promptOutput 변경하였습니다
이유는 FSD 환경에서는 PascalCase도 가능하지만, 현재 프로젝트는 React/TypeScript 환경이 아니므로 camelCase로 통일 + +## 아쉬운점 + +상수사용, enum, 사용하지 못한 점 +파일명에 대한 아쉬움 +함수를 더 쪼갤 수 있었을 것 같다는 것에 대한 아쉬움