refactor: convert to nullish condition check where appropriate