I think you just want to return `str` no? Or would returning "" when you got undefined/null be okay?