Refactor: simplify acceptsLanguages implementation using spread operator (#6137)

Refactored `req.acceptsLanguages` to use the spread operator for passing arguments directly to `accept.languages`, eliminating the need for `.apply`. This approach improves readability and streamlines the function call.
This commit is contained in:
Ayoub Mabrouk 2025-04-10 18:49:23 -07:00 committed by GitHub
parent fa40ecfe76
commit 3dc96995df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -169,9 +169,8 @@ req.acceptsCharsets = function(){
* @public
*/
req.acceptsLanguages = function(){
var accept = accepts(this);
return accept.languages.apply(accept, arguments);
req.acceptsLanguages = function(...languages) {
return accepts(this).languages(...languages);
};
/**