From bd05c2145617d00639f4edbd0fa522a56e48f5c7 Mon Sep 17 00:00:00 2001 From: Jonatan Nilsson Date: Fri, 11 Oct 2019 17:46:53 +0000 Subject: [PATCH] Fix linter errors --- lib/application.js | 4 ++-- lib/context.js | 4 ++-- lib/delegates.js | 48 +++++++++++++++++++++++----------------------- lib/request.js | 4 ++-- lib/response.js | 8 ++++---- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lib/application.js b/lib/application.js index 12adc00..02a6604 100644 --- a/lib/application.js +++ b/lib/application.js @@ -82,8 +82,8 @@ module.exports = class Application extends Emitter { return { subdomainOffset: this.subdomainOffset, proxy: this.proxy, - env: this.env, - } + env: this.env + }; } /** diff --git a/lib/context.js b/lib/context.js index cdaf153..21fa2fd 100644 --- a/lib/context.js +++ b/lib/context.js @@ -66,7 +66,7 @@ const proto = module.exports = { assert: function(test, status, message, props) { if (!test) { - this.throw(status, message, props) + this.throw(status, message, props); } }, @@ -153,7 +153,7 @@ const proto = module.exports = { this.status = err.status; this.length = Buffer.byteLength(msg); res.end(msg); - }, + } }; /** diff --git a/lib/delegates.js b/lib/delegates.js index e29760d..c32aa07 100644 --- a/lib/delegates.js +++ b/lib/delegates.js @@ -33,12 +33,12 @@ function Delegator(proto, target) { * @api public */ -Delegator.auto = function(proto, targetProto, targetProp){ - var delegator = Delegator(proto, targetProp); - var properties = Object.getOwnPropertyNames(targetProto); - for (var i = 0; i < properties.length; i++) { - var property = properties[i]; - var descriptor = Object.getOwnPropertyDescriptor(targetProto, property); +Delegator.auto = function(proto, targetProto, targetProp) { + let delegator = Delegator(proto, targetProp); + let properties = Object.getOwnPropertyNames(targetProto); + for (let i = 0; i < properties.length; i++) { + let property = properties[i]; + let descriptor = Object.getOwnPropertyDescriptor(targetProto, property); if (descriptor.get) { delegator.getter(property); } @@ -46,7 +46,7 @@ Delegator.auto = function(proto, targetProto, targetProp){ delegator.setter(property); } if (descriptor.hasOwnProperty('value')) { // could be undefined but writable - var value = descriptor.value; + let value = descriptor.value; if (value instanceof Function) { delegator.method(property); } else { @@ -67,12 +67,12 @@ Delegator.auto = function(proto, targetProto, targetProp){ * @api public */ -Delegator.prototype.method = function(name){ - var proto = this.proto; - var target = this.target; +Delegator.prototype.method = function(name) { + let proto = this.proto; + let target = this.target; this.methods.push(name); - proto[name] = function(){ + proto[name] = function() { return this[target][name].apply(this[target], arguments); }; @@ -87,7 +87,7 @@ Delegator.prototype.method = function(name){ * @api public */ -Delegator.prototype.access = function(name){ +Delegator.prototype.access = function(name) { return this.getter(name).setter(name); }; @@ -99,12 +99,12 @@ Delegator.prototype.access = function(name){ * @api public */ -Delegator.prototype.getter = function(name){ - var proto = this.proto; - var target = this.target; +Delegator.prototype.getter = function(name) { + let proto = this.proto; + let target = this.target; this.getters.push(name); - proto.__defineGetter__(name, function(){ + proto.__defineGetter__(name, function() { return this[target][name]; }); @@ -119,12 +119,12 @@ Delegator.prototype.getter = function(name){ * @api public */ -Delegator.prototype.setter = function(name){ - var proto = this.proto; - var target = this.target; +Delegator.prototype.setter = function(name) { + let proto = this.proto; + let target = this.target; this.setters.push(name); - proto.__defineSetter__(name, function(val){ + proto.__defineSetter__(name, function(val) { return this[target][name] = val; }); @@ -139,12 +139,12 @@ Delegator.prototype.setter = function(name){ * @api public */ -Delegator.prototype.fluent = function (name) { - var proto = this.proto; - var target = this.target; +Delegator.prototype.fluent = function(name) { + let proto = this.proto; + let target = this.target; this.fluents.push(name); - proto[name] = function(val){ + proto[name] = function(val) { if ('undefined' != typeof val) { this[target][name] = val; return this; diff --git a/lib/request.js b/lib/request.js index 67a33fa..59bfb8d 100644 --- a/lib/request.js +++ b/lib/request.js @@ -567,8 +567,8 @@ module.exports = { return { method: this.method, url: this.url, - header: this.header, - } + header: this.header + }; } }; diff --git a/lib/response.js b/lib/response.js index bc98a1a..99ebd7c 100644 --- a/lib/response.js +++ b/lib/response.js @@ -306,7 +306,7 @@ module.exports = { */ set type(orgType) { - let type = orgType + let type = orgType; if (!type) { this.remove('Content-Type'); return; @@ -317,7 +317,7 @@ module.exports = { // supported mime types. if (type.indexOf('/') > 0 || type.indexOf(';') > 0) { if (type.indexOf(';') === -1 && type.indexOf('text') >= 0) { - type += '; charset=utf-8' + type += '; charset=utf-8'; } this.set('Content-Type', type); } else if (type.indexOf('json') >= 0 || type.indexOf('css.map') >= 0 || type.indexOf('js.map') >= 0) { @@ -565,8 +565,8 @@ module.exports = { return { status: this.status, message: this.message, - header: this.header, - } + header: this.header + }; }, /**