consistent code style

No need for the `typeof` check; the return value of a function is never "not defined" (`typeof fn() === 'undefined'`) though it may be `undefined` (`fn() === undefined`).