Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove const for named fns and better stack trance #92

Merged
merged 1 commit into from
Mar 25, 2022

Conversation

jimmywarting
Copy link
Contributor

No description provided.

@jcoupey
Copy link
Contributor

jcoupey commented Mar 25, 2022

Thanks for taking the time to suggest some changes! Can you elaborate a bit on how this actually improves things?

@jimmywarting
Copy link
Contributor Author

not only is it shorter and giving you the possibility to omit const when it isn't needed. It also gives a better error message in the stacktrace/log

Because the function name appears in the error log, named functions are highly useful in debugging and determining which function produced an error.
https://www.geeksforgeeks.org/difference-between-anonymous-and-named-functions-in-javascript/

it don't have huge benefits, it just comes down to preferable taste like immutable or mutable, colon vs non-colon or tab vs space... so if you like to reject this PR, then that is fine...

I guess if i would have sticked with the const syntax then i would have made this into a one liner to omit return and function keywords instead by using arrow fn

const now = () => new Date().toUTCString()

i'm a nerd when it comes to byte saving technic sometimes.

@jcoupey jcoupey merged commit ad53229 into VROOM-Project:master Mar 25, 2022
@jcoupey jcoupey added this to the v0.11.0 milestone Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants