-
-
Save suzdalnitski/34d6d33a2b998370c898121651d7dbad to your computer and use it in GitHub Desktop.
This file contains 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
// before refactoring: | |
// calculator.js: | |
const isValidInput = text => true; | |
const btnAddClick = (aText, bText) => { | |
if (!isValidInput(aText) || !isValidInput(bText)) { | |
return; | |
} | |
} | |
// after refactoring: | |
// inputValidator.js: | |
export const isValidInput = text => true; | |
// calculator.js: | |
import { isValidInput } from './inputValidator'; | |
const btnAddClick = (aText, bText, _isValidInput = isValidInput) => { | |
if (!_isValidInput(aText) || !_isValidInput(bText)) { | |
return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment