Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
zlib: name every function
Ref: #8913
  • Loading branch information
solebox committed Oct 31, 2016
commit b57c1f84623214d54b2b558cb813efcc147790fb
7 changes: 4 additions & 3 deletions lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ function Zlib(opts, mode) {

var self = this;
this._hadError = false;
this._handle.onerror = function(message, errno) {
this._handle.onerror = (message, errno) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't change this one to an arrow function. There's really no point in doing so here. I would just add a name to the existing function

// there is no way to cleanly recover.
// continuing only obscures problems.
_close(self);
Expand Down Expand Up @@ -402,7 +402,7 @@ Zlib.prototype.params = function(level, strategy, callback) {

if (this._level !== level || this._strategy !== strategy) {
var self = this;
this.flush(constants.Z_SYNC_FLUSH, function() {
this.flush(constants.Z_SYNC_FLUSH, function flushCallback() {
assert(self._handle, 'zlib binding closed');
self._handle.params(level, strategy);
if (!self._hadError) {
Expand Down Expand Up @@ -443,7 +443,8 @@ Zlib.prototype.flush = function(kind, callback) {
this.once('end', callback);
} else if (ws.needDrain) {
if (callback) {
this.once('drain', () => this.flush(kind, callback));
const drainHandler = () => this.flush(kind, callback);
this.once('drain', drainHandler);
}
} else {
this._flushFlag = kind;
Expand Down