From 1ebb15766523242e5aea454ea5cfbd3d49bf530e Mon Sep 17 00:00:00 2001 From: Ayoub-Mabrouk Date: Mon, 4 Nov 2024 02:17:42 +0100 Subject: [PATCH] Refactor: simplify req.acceptsCharsets with spread syntax 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. --- lib/request.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/request.js b/lib/request.js index 372a9915e9..75d8a9e875 100644 --- a/lib/request.js +++ b/lib/request.js @@ -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); }; /**