File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -5,27 +5,28 @@ const Duplex = require('stream').Transform;
5
5
6
6
const stream = new Duplex ( { objectMode : true } ) ;
7
7
8
+ assert ( Duplex ( ) instanceof Duplex ) ;
8
9
assert ( stream . _readableState . objectMode ) ;
9
10
assert ( stream . _writableState . objectMode ) ;
10
11
11
12
let written ;
12
13
let read ;
13
14
14
- stream . _write = function ( obj , _ , cb ) {
15
+ stream . _write = ( obj , _ , cb ) => {
15
16
written = obj ;
16
17
cb ( ) ;
17
18
} ;
18
19
19
- stream . _read = function ( ) { } ;
20
+ stream . _read = ( ) => { } ;
20
21
21
- stream . on ( 'data' , function ( obj ) {
22
+ stream . on ( 'data' , ( obj ) => {
22
23
read = obj ;
23
24
} ) ;
24
25
25
26
stream . push ( { val : 1 } ) ;
26
27
stream . end ( { val : 2 } ) ;
27
28
28
- process . on ( 'exit' , function ( ) {
29
+ process . on ( 'exit' , ( ) => {
29
30
assert . strictEqual ( read . val , 1 ) ;
30
31
assert . strictEqual ( written . val , 2 ) ;
31
32
} ) ;
You can’t perform that action at this time.
0 commit comments