Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
![](/static/devrant/img/pipeless-devrant-banner-white.png)
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
retoor930488dAnd you've posted it for review and left half review. You disappeared. @joewilliams007 had a point left.
Two times env is declared.
Besides that, nice clean stuff dude -
cafecortado752988dI would love to be a free spirit like you but sadly my PRs won't be approved if I do that.
-
jestdotty408688done of us, one of us
there also might be few of us and we might be an endangered species and it's ok to shoot us culturally for some reason 😒 -
Ranchonyx1045788d@retoor Strict coding conventions to whatever project he's pushing to, likely. Some people find that early returns decrease readability... For whatever reason.
-
retoor930488d@Ranchonyx there's some whole myth stuff about if else blocks regarding cpu cache and shit. Do not count for js I suppose. Sick stuff people do for performance. I worked somewhere where they used tuples instead or arrays in python because of performance. Whaha
-
Ranchonyx1045788d@retoor blegh... For me I stand with saying "The earlier a function returns, the better..."
-
Demolishun3288688d@Ranchonyx but what about taking longer to return to more fully satisfy the logic conditions. Surely the experience of the function is important.
-
netikras3495088dyeah, except it does make traceability slightly more difficult in long/complex methods.
If I have a nested if-else tree, I try to find a way to either split it into separate methods and "hide" the tree there (x1 if-else per method) OR make an enum-based logic where I pick the processing function from the map (resolution the KEY is often hidden in a dedicated, often times nasty, if-else riddled method).
I've shifted from writing nested ifs to writing early returns. Feels great.
rant