Skip to content

Commit

Permalink
Refactor: simplify req.acceptsCharsets with spread syntax
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ayoub-Mabrouk committed Nov 4, 2024
1 parent b31910c commit 1ebb157
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,8 @@ req.acceptsEncodings = function(){
* @public
*/

req.acceptsCharsets = function(){
var accept = accepts(this);
return accept.charsets.apply(accept, arguments);
req.acceptsCharsets = function(...charsets) {
return accepts(this).charsets(...charsets);
};

/**
Expand Down

0 comments on commit 1ebb157

Please sign in to comment.