4 ms·
This particular refactor (changing `if (err) { return ... }` to `if (err) return ...`) didn't actually reduce indentation levels though. It only reduced the num
by thomasahle 9y ago
This particular refactor (changing `if (err) { return ... }` to `if (err) return ...`) didn't actually reduce indentation levels though. It only reduced the number of lines.
- moomin 9y agoYeah, I’ll file that under “maybe don’t do that”.
- timoxley 9y agowhat are the downsides
- 84Winston 9y agoremoving "unnecessary" {}? potential disaster. http://heartbleed.com/ http://heartbleed.com/
- moomin 9y agoIn general terms, in C-like languages, mixing braces and semi-colons is horribly refactor unfriendly and bug prone. Meanwhile, sticking things on one line introduces a cognitive load that you might not want. (YMMV on the second point, but I’ve pretty strong views on the first.)