Skip to content

Instantly share code, notes, and snippets.

@marcelo-ribeiro
Last active March 2, 2018 15:28
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 marcelo-ribeiro/f7536e88d32dcb5e2ad4ee073e9a6377 to your computer and use it in GitHub Desktop.
Save marcelo-ribeiro/f7536e88d32dcb5e2ad4ee073e9a6377 to your computer and use it in GitHub Desktop.
ES6 defaults / overrides pattern
var defaults = {
bar: 'no',
baz: 'works!'
};
function foo( options ) {
Object.assign( defaults, options );
console.log( defaults );
}
foo({
bar: 'yay'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment