Last active
July 10, 2018 21:35
-
-
Save chandlerprall/5471df72c5d05b0590cb6de88f1f425b 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
function doSomething(config) { | |
var result = {}; | |
if (config.enableA) { | |
... 10 lines of code ... | |
result.A = {}; | |
} | |
if (config.enableB) { | |
... 15 lines of code ... | |
result.B = {}; | |
} | |
if (config.enableC) { | |
... 8 lines of code ... | |
result.C = {}; | |
} | |
... 20 lines of code, dependent on the preceeding if blocks ... | |
} | |
doSomething({dataForA: {}, enableA: {}, dataForC: {}, dataForC: {}}) | |
// OR | |
doSomethingOtherVersion({ | |
...doSomethingForA(dataForA), | |
...doSomethingForC(dataForC), | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment