From 654c824fdd63385a9476808d495533bfe8a233f3 Mon Sep 17 00:00:00 2001 From: Charlie Moore Date: Mon, 4 Oct 2021 12:21:34 -0400 Subject: [PATCH] Add check to handle empty string input. Could throw an error instead, but to be consistent with other case conversion functions in this collection, it returns an empty string when input is empty string. --- Conversions/TitleCaseConversion.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Conversions/TitleCaseConversion.js b/Conversions/TitleCaseConversion.js index 72ba26299..44967d124 100644 --- a/Conversions/TitleCaseConversion.js +++ b/Conversions/TitleCaseConversion.js @@ -11,6 +11,7 @@ * @returns {string} A string that is in title case. */ const titleCaseConversion = (inputString) => { + if (inputString === '') return '' // Extact all space seprated string. const stringCollections = inputString.split(' ').map(word => { let firstChar = ''