Skip to content

Commit 56488bf

Browse files
committed
refactor: arrow functions
1 parent 4de5ccf commit 56488bf

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

lib/node-static.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,11 @@ class Server {
194194
}
195195

196196
serve (req, res, callback) {
197-
const that = this,
198-
promise = new(events.EventEmitter);
197+
const promise = new(events.EventEmitter);
199198
let pathname;
200199

201-
const finish = function (status, headers, streaming) {
202-
that.finish(status, headers, req, res, promise, callback, streaming);
200+
const finish = (status, headers, streaming) => {
201+
this.finish(status, headers, req, res, promise, callback, streaming);
203202
};
204203

205204
try {
@@ -211,8 +210,8 @@ class Server {
211210
});
212211
}
213212

214-
process.nextTick(function () {
215-
that.servePath(pathname, 200, {}, req, res, finish).on('success', function (result) {
213+
process.nextTick(() => {
214+
this.servePath(pathname, 200, {}, req, res, finish).on('success', function (result) {
216215
promise.emit('success', result);
217216
}).on('error', function (err) {
218217
promise.emit('error');

0 commit comments

Comments
 (0)