Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zlib: name every function #9389

Closed
wants to merge 2 commits into from
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
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
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