Skip to content

Instantly share code, notes, and snippets.

@whitelizard
Last active September 26, 2021 17:27
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 whitelizard/026414cbcc195eb6e73568d5b00ed6a4 to your computer and use it in GitHub Desktop.
Save whitelizard/026414cbcc195eb6e73568d5b00ed6a4 to your computer and use it in GitHub Desktop.
Destructuring possibilities
const func = (
{
fallbackMessage: msg = 'Unknown',
offset = 4,
pos: { x = 0, y = 0 } = {},
...options
} = {},
data = {},
) => {
const { title = '', items: [head, ...tail] = [] } = data;
// some nice logic
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment