DEV Community

Discussion on: ✔||🤢 Commit or Vomit | Switch(true)

Collapse
 
aleksandrhovhannisyan profile image
Aleksandr Hovhannisyan • Edited

Why the need for the case statement?

if (userMissedAppointment) {
  return 'nope';
}
const userMeetsTechRequirements = userHasAngularExperience || userHasReactExperience || userHasVueExperience;
if (userMeetsTechRequirements && userCanStartInstantly) {
   return 'hire';
}
return 'maybe'
Enter fullscreen mode Exit fullscreen mode

Also, imo, there's no need to repeat "user" in these flags. You could just say canStartInstantly, for example. There's no ambiguity regarding who this refers to.

Collapse
 
jmdejager profile image
🐤🥇 Jasper de Jager

Totally agree, but would you merge it if it was in a PR for instance?

Collapse
 
aleksandrhovhannisyan profile image
Aleksandr Hovhannisyan

Nope, I'd request changes here.