Created
August 17, 2016 13:41
-
-
Save conor909/d85ae58b7af14a49cc40e262085a2c96 to your computer and use it in GitHub Desktop.
when returning booleans from a function based on the result of an if statement
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 timeframeAffectsKpiData = (isInstantKpi, timeframe) => { | |
if (timeframe && isInstantKpi && !timeframeContainsToday(timeframe)) { | |
return false; | |
} | |
return true; | |
}; | |
//vs | |
const timeframeAffectsKpiData = (isInstantKpi, timeframe) => { | |
return !isInstantKpi || timeframeContainsToday(timeframe); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment