Closed (fixed)
Project:
Drupal core
Version:
8.5.x-dev
Component:
quickedit.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
8 Oct 2017 at 11:37 UTC
Updated:
28 Oct 2017 at 00:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
nod_I'd reverse the condition instead of returning early but it works the same.
Comment #3
nod_Comment #4
alexpottI'd reverse it too... also the patch no longer applies.
Comment #5
droplet commentedComment #7
droplet commentedComment #8
alexpott@droplet can we swap the logic around too?
I think we want something like this...
Comment #9
droplet commentedwhy not :)
Comment #11
alexpottI might be wrong but I think this needs to be
&&Comment #12
droplet commentedOh Oh. Made a simple mistake.
What do you think this version to keep separate comments:
Comment #13
dawehnerLet's set the correct status at the moment.
At least for me #12 feels less readable actually.
Comment #14
droplet commentedI prefer the early return in #7 and think that's more common in JS :p
It need not compute the && logic (0.00000000001s faster). So while on debugging, you see either one meet the condition, you got it!
Comment #15
dawehnerLet's go with it!
Comment #16
droplet commentedGuardClause:
http://wiki.c2.com/?GuardClause
Refactoring: Improving the Design of Existing Code
Comment #18
xjmIt's JavaScript even I can read!
The fact that the inline comment more closely matches the changed code in #14 makes me agree that this way around makes more sense.
I confirmed that:
yarn lint:core-js-stats).Committed and pushed to 8.5.x. Thanks!