Skip to content

Instantly share code, notes, and snippets.

@lpaulger
Last active Jun 30, 2016
Embed
What would you like to do?
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