Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save nivrith/5ceca12345afa5cbbf7cc00b474849d9 to your computer and use it in GitHub Desktop.

Select an option

Save nivrith/5ceca12345afa5cbbf7cc00b474849d9 to your computer and use it in GitHub Desktop.
Destructured object parameters are better than multiple function parameters
function getImageURLById({imageId, asAttachment = false, asThumbnail = false, withCompression = false}) {
...
}
// This is more readable and doesn't require checking the function definition
getImageURLById({imageId: 25, asAttachment: true, withCompression: true});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment