Skip to content
Myr

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

Before adoption: this commit came in with the history the project adopted, so no landing records it.

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.

authored by Ayoub Mabrouk · committed by GitHub · parent fa40ecf · Browse files · 1 file+2 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−3 removed

  • other:+2 added−3 removed

1 file+2 added−3 removed

modified:lib/request.js+2 added-3 removed
167 unmodified lines
168 * @return {String|Array}169 * @public170 */171172req.acceptsLanguages = function(){173 var accept = accepts(this);174 return accept.languages.apply(accept, arguments);172req.acceptsLanguages = function(...languages) {173 return accepts(this).languages(...languages);174};175176/**177 * Parse Range header field, capping to the given `size`.
337 unmodified lines