I think I did it this way because the issue popped up in prod for us (we did not pass undefined in intentionally).  The error message we got was not very useful in tracking it down.