Last active
September 13, 2019 16:43
-
-
Save lolmaus/5abbc25f6147494add47fe3b31231ac5 to your computer and use it in GitHub Desktop.
Ternary vs ifs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isHidden = | |
option.selectable !== undefined ? option.selectable : | |
hasOptedIntoDisabledOptions ? values.all.length > 1 : | |
getAvailableOptionValues(option, state, constraints).length > 1 ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let isHidden; | |
if (option.selectable !== undefined) { | |
isHidden = option.selectable; | |
} else if(hasOptedIntoDisabledOptions) { | |
isHidden = values.all.length > 1 | |
} else { | |
isHidden = getAvailableOptionValues(option, state, constraints).length > 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment