VROOM-Project / vroom-express

Out of the box Node-express server to use VROOM as a web API.
BSD 2-Clause "Simplified" License
70 stars 60 forks source link

remove const for named fns and better stack trance #92

Closed jimmywarting closed 2 years ago

jcoupey commented 2 years ago

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

jimmywarting commented 2 years ago

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.