Skip to content

Commit fe21886

Browse 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 ccdf4b2 commit fe21886

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
@@ -15,15 +15,15 @@ class MyStream extends Readable {
1515
case 0:
1616
return this.push(null);
1717
case 1:
18-
return setTimeout(function() {
18+
return setTimeout(() => {
1919
this.push('last chunk');
20-
}.bind(this), 100);
20+
}, 100);
2121
case 2:
2222
return this.push('second to last chunk');
2323
case 3:
24-
return process.nextTick(function() {
24+
return process.nextTick(() => {
2525
this.push('first chunk');
26-
}.bind(this));
26+
});
2727
default:
2828
throw new Error('?');
2929
}

test/parallel/test-stream2-transform.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,14 @@ const Transform = require('_stream_transform');
190190
if (!chunk)
191191
chunk = '';
192192
const s = chunk.toString();
193-
setTimeout(function() {
193+
setTimeout(() => {
194194
this.state += s.charAt(0);
195195
if (this.state.length === 3) {
196196
pt.push(Buffer.from(this.state));
197197
this.state = '';
198198
}
199199
cb();
200-
}.bind(this), 10);
200+
}, 10);
201201
};
202202

203203
pt._flush = function(cb) {

0 commit comments

Comments
 (0)