File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 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;
55
66const stream = new Duplex ( { objectMode : true } ) ;
77
8+ assert ( Duplex ( ) instanceof Duplex ) ;
89assert ( stream . _readableState . objectMode ) ;
910assert ( stream . _writableState . objectMode ) ;
1011
1112let written ;
1213let read ;
1314
14- stream . _write = function ( obj , _ , cb ) {
15+ stream . _write = ( obj , _ , cb ) => {
1516 written = obj ;
1617 cb ( ) ;
1718} ;
1819
19- stream . _read = function ( ) { } ;
20+ stream . _read = ( ) => { } ;
2021
21- stream . on ( 'data' , function ( obj ) {
22+ stream . on ( 'data' , ( obj ) => {
2223 read = obj ;
2324} ) ;
2425
2526stream . push ( { val : 1 } ) ;
2627stream . end ( { val : 2 } ) ;
2728
28- process . on ( 'exit' , function ( ) {
29+ process . on ( 'exit' , ( ) => {
2930 assert . strictEqual ( read . val , 1 ) ;
3031 assert . strictEqual ( written . val , 2 ) ;
3132} ) ;
You can’t perform that action at this time.
0 commit comments