Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(xy): drop triple equals true on booleans #1350
refactor(xy): drop triple equals true on booleans #1350
Changes from 11 commits
3807895
efb98ab
825e9d4
bdfaa3f
5f5b06a
fb135a2
965cebb
f866fea
10debfd
75097b4
d59bdd2
3182b2c
439dd8d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know, something about all the conditionals in this fn, are driving me nuts.
It's probably purely academic, but the fact that it checks for
truthy
againstinverseForContrast
three times keeps bothering me.Again, not worth it, but it flows terribly in my eyes, just a personal style nit though.
Not worth upsetting anyone. I did the same code elsewhere in Kibana, and it still bothers me.
I just didnt feel like writing my own
cond
fn lol.Cond
A fn takes a list of predicate fns and then executes different fns, based on the predicates passed in. I'm not even sure how best to impl that. Interesting thought exercise though.
Kinda like: https://ramdajs.com/docs/#cond
I'm just venting emotionally though hahahahaaa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I did is just as "unattractive": https://github.com/elastic/kibana/blob/master/src/dev/code_coverage/ingest_coverage/either.js#L49
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I think about it, this could be simply
, ratio
...should be undefined if it's not passed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@monfera thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can explain my way why we should refactor this function in a different way:
makeHighContrastColor
with an rgba or rgb color is exactly the same. The internal code take care of the values.rgba
color starting from anrgb
color adding opacity 1ratio
or is defined and a number if not it should be left undefined living themakeHighContrastColor
use the default valueI have some doubts on the real need of this function anyway, but if we extract it out of the context this is my solution