Skip to content

Commit 2776816

Browse files
tniessenMylesBorins
authored andcommitted
test: use arrow functions instead of bind
PR-URL: #17070 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Lance Ball <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Khaidi Chu <[email protected]>
1 parent c917cd6 commit 2776816

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

+4-4
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
}

test/parallel/test-stream2-transform.js

+2-2
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)