We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b5e8413 commit f3efaeeCopy full SHA for f3efaee
test/parallel/test-stream-duplex.js
@@ -5,27 +5,28 @@ const Duplex = require('stream').Transform;
5
6
const stream = new Duplex({ objectMode: true });
7
8
+assert(Duplex() instanceof Duplex);
9
assert(stream._readableState.objectMode);
10
assert(stream._writableState.objectMode);
11
12
let written;
13
let read;
14
-stream._write = function(obj, _, cb) {
15
+stream._write = (obj, _, cb) => {
16
written = obj;
17
cb();
18
};
19
-stream._read = function() {};
20
+stream._read = () => {};
21
-stream.on('data', function(obj) {
22
+stream.on('data', (obj) => {
23
read = obj;
24
});
25
26
stream.push({ val: 1 });
27
stream.end({ val: 2 });
28
-process.on('exit', function() {
29
+process.on('exit', () => {
30
assert.strictEqual(read.val, 1);
31
assert.strictEqual(written.val, 2);
32
0 commit comments