Skip to content

Refactor: simplify req.acceptsCharsets with spread syntax - #6138

Open
Ayoub-Mabrouk wants to merge 1 commit into
expressjs:masterfrom
Ayoub-Mabrouk:chore/acceptsCharsets
Open

Refactor: simplify req.acceptsCharsets with spread syntax#6138
Ayoub-Mabrouk wants to merge 1 commit into
expressjs:masterfrom
Ayoub-Mabrouk:chore/acceptsCharsets

Conversation

@Ayoub-Mabrouk

Copy link
Copy Markdown
Contributor

Replaces arguments with spread syntax (...charsets) in req.acceptsCharsets, making the function more concise and improving readability. The new implementation passes arguments directly to accepts(this).charsets, achieving the same functionality with cleaner code.

Replaces `arguments` with spread syntax (`...charsets`) in `req.acceptsCharsets`, making the function more concise and improving readability. The new implementation passes arguments directly to `accepts(this).charsets`, achieving the same functionality with cleaner code.
@Abdel-Monaam-Aouini

Copy link
Copy Markdown
Contributor

already added ! #6088

@Ayoub-Mabrouk

Copy link
Copy Markdown
Contributor Author

already added ! #6088

Hello @Abdel-Monaam-Aouini Thanks for your input on this! I went with a slightly different approach to keep things concise by calling accept.charsets(...charsets) 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!

@nidhishgajjar

This comment was marked as spam.

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.

3 participants