Open Ayoub-Mabrouk opened 2 weeks ago
The change from var to const can have dramatic effects, if you dont know the whole subject, please refrain from mass commits in the name of clean code. There is a reason for everything
Hello @Abdul-Raffay-0 Thanks for your comment! I wanted to clarify the recent change from var
to const
for queryparse
in the defineGetter
function. This shift is actually a positive move for our code. By using const
, we prevent accidental reassignment, which helps keep queryparse
stable and predictable within its specific scope. This is especially useful in larger codebases where variables can easily get mixed up.
The defineGetter
function itself is used to create convenient properties on the req
object—like req.query
, req.protocol
, and req.ip
. Each property has a getter function for easy access, and using const
for queryparse
keeps it isolated from other parts of the code, ensuring no unintended side effects.
I also appreciate your input about mass commits. It's a good reminder that we should double-check our understanding before making strong statements. It's always better to confirm that we’re on the same page first.
If you’d like to chat more about this or have any other questions, feel free to reach out. Have a wonderful day!