Skip to content

Instantly share code, notes, and snippets.

@JoaoCnh
Last active July 10, 2017 19:55
Show Gist options
  • Save JoaoCnh/53f339d8aba5d20fece505ff6750b931 to your computer and use it in GitHub Desktop.
Save JoaoCnh/53f339d8aba5d20fece505ff6750b931 to your computer and use it in GitHub Desktop.
refactored code
const dataIsEmpty = data.length === 0;
const valueCeil = Math.ceil(data.someValue);
const valueCeilIsValid = helperClass.isValid(valueCeil);
if (dataIsEmpty && valueCeilIsValid) {
runFunctionA(data);
} else {
runFunctionB(data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment