-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
lib: use arrow functions instead of bind #3622
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1842,7 +1842,7 @@ ReadStream.prototype.close = function(cb) { | |
this.once('open', close); | ||
return; | ||
} | ||
return process.nextTick(this.emit.bind(this, 'close')); | ||
return process.nextTick(() => this.emit('close')); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also this case is particularly easy -- no other arguments will need to be passed because none were passed to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need, the above change is correct. |
||
} | ||
this.closed = true; | ||
close(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one takes one argument,
res
(response).If you search the file for
_onResponse
(The function being bind), you should be able to tell what arguments it can take: https://github.com/nodejs/node/blob/master/lib/_debugger.jsSo we need to update the change to look like
protocol.onResponse = (res) => this._onResponse(res);
(Note: if anything uses
arguments
, we need to look at in more detail.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This will need to also be done all of the others.)