Skip to content

Instantly share code, notes, and snippets.

@jackfranklin
Created October 21, 2015 13:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackfranklin/d0d7162c524aacbd285f to your computer and use it in GitHub Desktop.
Save jackfranklin/d0d7162c524aacbd285f to your computer and use it in GitHub Desktop.
Deep destructuring and renaming in ES6
function foo({ text, user: { screen_name: screenName }}) {
console.log('text', text);
console.log('name', screenName);
}
foo({
text: 'hello world',
user: { screen_name: 'Jack' },
});
// => text 'hello world'
// => name 'Jack'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment