Last active
June 30, 2016 15:29
-
-
Save lpaulger/88049f7bff621d77b385dd4f0346b47b to your computer and use it in GitHub Desktop.
good parameters example
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
//DO | |
function example(options) { | |
//this clearly identifies what the expected parameters are | |
const { | |
injectedLibrary, | |
otherThing | |
} = options; | |
this.methodOne = function(){ | |
injectedLibrary.doSomething('methodOne') | |
} | |
this.methodTwo = function(){ | |
otherThing.whoami('methodTwo') | |
} | |
} | |
//Dont | |
function example(options) { | |
this.methodOne = function(){ | |
options.injectedLibrary.doSomething('methodOne') | |
} | |
this.methodTwo = function(){ | |
options.otherThing.whoami('methodTwo') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment