simplify null guard

We could use `!== null` here instead, since `typeof undefined` is not `'object'`, but as a general rule I avoid differentiating between null and undefined.