Last active
November 27, 2020 09:51
-
-
Save nivrith/5ceca12345afa5cbbf7cc00b474849d9 to your computer and use it in GitHub Desktop.
Destructured object parameters are better than multiple function parameters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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