Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2776816

Browse filesBrowse files
tniessenMylesBorins
authored andcommitted
test: use arrow functions instead of bind
PR-URL: #17070 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Lance Ball <lball@redhat.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Khaidi Chu <i@2333.moe>
1 parent c917cd6 commit 2776816
Copy full SHA for 2776816

File tree

Expand file treeCollapse file tree

2 files changed

+6
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-6
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-stream-push-strings.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-stream-push-strings.js
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ class MyStream extends Readable {
3636
case 0:
3737
return this.push(null);
3838
case 1:
39-
return setTimeout(function() {
39+
return setTimeout(() => {
4040
this.push('last chunk');
41-
}.bind(this), 100);
41+
}, 100);
4242
case 2:
4343
return this.push('second to last chunk');
4444
case 3:
45-
return process.nextTick(function() {
45+
return process.nextTick(() => {
4646
this.push('first chunk');
47-
}.bind(this));
47+
});
4848
default:
4949
throw new Error('?');
5050
}
Collapse file

‎test/parallel/test-stream2-transform.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-stream2-transform.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,14 @@ const Transform = require('_stream_transform');
211211
if (!chunk)
212212
chunk = '';
213213
const s = chunk.toString();
214-
setTimeout(function() {
214+
setTimeout(() => {
215215
this.state += s.charAt(0);
216216
if (this.state.length === 3) {
217217
pt.push(Buffer.from(this.state));
218218
this.state = '';
219219
}
220220
cb();
221-
}.bind(this), 10);
221+
}, 10);
222222
};
223223

224224
pt._flush = function(cb) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.