From ee5af59f1f847922c9cf41ccedbdbe6a3c024c2e Mon Sep 17 00:00:00 2001 From: Thiago Lagden Date: Sun, 23 Apr 2017 20:14:16 -0300 Subject: [PATCH] replace apply by spread syntax (#971) --- lib/application.js | 4 ++-- lib/context.js | 4 ++-- lib/request.js | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/application.js b/lib/application.js index a2eaa11..a013c96 100644 --- a/lib/application.js +++ b/lib/application.js @@ -58,10 +58,10 @@ module.exports = class Application extends Emitter { * @api public */ - listen() { + listen(...args) { debug('listen'); const server = http.createServer(this.callback()); - return server.listen.apply(server, arguments); + return server.listen(...args); } /** diff --git a/lib/context.js b/lib/context.js index 8e46d20..ece4718 100644 --- a/lib/context.js +++ b/lib/context.js @@ -87,8 +87,8 @@ const proto = module.exports = { * @api public */ - throw() { - throw createError.apply(null, arguments); + throw(...args) { + throw createError(...args); }, /** diff --git a/lib/request.js b/lib/request.js index a1be181..5c9a241 100644 --- a/lib/request.js +++ b/lib/request.js @@ -460,8 +460,8 @@ module.exports = { * @api public */ - accepts() { - return this.accept.types.apply(this.accept, arguments); + accepts(...args) { + return this.accept.types(...args); }, /** @@ -477,8 +477,8 @@ module.exports = { * @api public */ - acceptsEncodings() { - return this.accept.encodings.apply(this.accept, arguments); + acceptsEncodings(...args) { + return this.accept.encodings(...args); }, /** @@ -494,8 +494,8 @@ module.exports = { * @api public */ - acceptsCharsets() { - return this.accept.charsets.apply(this.accept, arguments); + acceptsCharsets(...args) { + return this.accept.charsets(...args); }, /** @@ -511,8 +511,8 @@ module.exports = { * @api public */ - acceptsLanguages() { - return this.accept.languages.apply(this.accept, arguments); + acceptsLanguages(...args) { + return this.accept.languages(...args); }, /**