I think you can just use `rating !== undefined` here.