Skip to content

Commit

Permalink
fs: use arrow function for lexical this
Browse files Browse the repository at this point in the history
  • Loading branch information
originalfoo committed Jun 25, 2016
1 parent c70eeac commit 9e889cf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,6 @@ WriteStream.prototype._writev = function(data, cb) {
this._writev(data, cb);
});

const self = this;
const len = data.length;
const chunks = new Array(len);
var size = 0;
Expand All @@ -1940,12 +1939,12 @@ WriteStream.prototype._writev = function(data, cb) {
size += chunk.length;
}

writev(this.fd, chunks, this.pos, function(er, bytes) {
writev(this.fd, chunks, this.pos, (er, bytes) => {
if (er) {
self.destroy();
this.destroy();
return cb(er);
}
self.bytesWritten += bytes;
this.bytesWritten += bytes;
cb();
});

Expand Down

0 comments on commit 9e889cf

Please sign in to comment.