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.
This commit is contained in:
Charlie Moore
2021-10-04 12:21:34 -04:00
parent 184814745e
commit 654c824fdd

View File

@ -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 = ''