Skip to content

Instantly share code, notes, and snippets.

@lpaulger
Last active June 30, 2016 15:29
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 lpaulger/88049f7bff621d77b385dd4f0346b47b to your computer and use it in GitHub Desktop.
Save lpaulger/88049f7bff621d77b385dd4f0346b47b to your computer and use it in GitHub Desktop.
good parameters example
//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