r/javascript • u/bogdanelcs • Jul 16 '26
I stopped destructuring everything
https://allthingssmitty.com/2026/07/13/i-stopped-destructuring-everything/
84
Upvotes
r/javascript • u/bogdanelcs • Jul 16 '26
View all comments
Show parent comment
4
u/caindela Jul 16 '26
This is probably your point and if so I’m happy to reinforce it, but although the comment in your example is crazy I actually think that function is not bad. From the caller it’s likely that ‘clearToken()’ is in the wrong abstraction layer and doesn’t read well. Clearing the token is an implementation detail of the logging out process and so from that perspective I may very well write this same function since it makes the code much more readable from the caller.
The above is more of a textbook example (I don’t know how often I’d actually write a one line function), but that’s at least what I try to aim for.