From 6f117b6f6ebab313fe1d661f02dc1fa00e2444df Mon Sep 17 00:00:00 2001 From: iswilljr Date: Tue, 12 Dec 2023 10:35:44 -0500 Subject: [PATCH] feat(2023): update solution for challenge #12 --- 2023/challenge-12/challenge-12.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/2023/challenge-12/challenge-12.ts b/2023/challenge-12/challenge-12.ts index 1a16844..1b86d19 100644 --- a/2023/challenge-12/challenge-12.ts +++ b/2023/challenge-12/challenge-12.ts @@ -14,8 +14,12 @@ export function checkIsValidCopy(original: string, copy: string) { ' ', ].includes(copyLetter) - const isBlankSpace = +(letter === ' ') - const isValidCharacter = [isValidLetter, copyLetter === ' '][isBlankSpace] + const isLetterBlankSpace = letter === ' ' + const isCopyLetterBlankSpace = copyLetter === ' ' + + const isValidCharacter = [isValidLetter, isCopyLetterBlankSpace][ + +isLetterBlankSpace + ] isValidCopy = [isValidCopy, isValidCharacter][+isValidCopy] }