express icon indicating copy to clipboard operation
express copied to clipboard

Refactor: simplify req.acceptsEncodings with spread syntax

Open Ayoub-Mabrouk opened this issue 1 year ago • 2 comments

Replaced use of arguments in req.acceptsEncodings with the spread syntax (...encodings) to improve readability and reduce code complexity, while maintaining the same functionality.

Ayoub-Mabrouk avatar Nov 04 '24 01:11 Ayoub-Mabrouk

already added https://github.com/expressjs/express/pull/6086

Abdel-Monaam-Aouini avatar Nov 04 '24 19:11 Abdel-Monaam-Aouini

already added #6086

Hello @Abdel-Monaam-Aouini Thanks for your input on this! I went with a slightly different approach to keep things concise by calling accepts(this).encodings(...encodings) directly, avoiding the intermediate accept variable. This makes the code a bit more streamlined and skips a minor, unnecessary allocation. I thought this might be more consistent with our style, but I’m happy to discuss if you see other benefits to your approach!

Ayoub-Mabrouk avatar Nov 05 '24 21:11 Ayoub-Mabrouk