Skip to content

Instantly share code, notes, and snippets.

@chandlerprall
Last active July 10, 2018 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chandlerprall/5471df72c5d05b0590cb6de88f1f425b to your computer and use it in GitHub Desktop.
Save chandlerprall/5471df72c5d05b0590cb6de88f1f425b to your computer and use it in GitHub Desktop.
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