Add safe string method access for toTitleCase

This commit is contained in:
Kyle Shockey
2017-11-10 16:56:38 -08:00
parent c3b7f071c8
commit 82a2ee9a34

View File

@@ -113,7 +113,7 @@ const SpecErrorItem = ( { error, jumpToLine } ) => {
} }
function toTitleCase(str) { function toTitleCase(str) {
return str return (str || "")
.split(" ") .split(" ")
.map(substr => substr[0].toUpperCase() + substr.slice(1)) .map(substr => substr[0].toUpperCase() + substr.slice(1))
.join(" ") .join(" ")