News for hackers. Stuff that matters.
Re:Anti-If: The missing patterns (2016) by ballenf on Wednesday June 27, 2018 @10:43AM (#17408506)
Rename a and b to reasonable names:

a -> isAdmin

b -> isActive

    const isDeletableUser = !isAdmin && isActive;

    return isDeletableUser;
(Better would be naming the function "isDeletableUser" instead of the intermediate const, but was keeping with the original.)

Point is for me that booleans with readable names shows how eliminating ifs becomes not only doable but arguably preferable.

There are no comments on this comment yet.