66'use strict' ;
77
88/*<replacement>*/
9+
910var objectKeys = Object . keys || function ( obj ) {
1011 var keys = [ ] ;
11- for ( var key in obj ) { keys . push ( key ) ; }
12- return keys ; } ;
13-
12+ for ( var key in obj ) {
13+ keys . push ( key ) ;
14+ } return keys ;
15+ } ;
1416/*</replacement>*/
1517
16-
1718module . exports = Duplex ;
1819
1920/*<replacement>*/
2021var processNextTick = require ( 'process-nextick-args' ) ;
2122/*</replacement>*/
2223
23-
24-
2524/*<replacement>*/
2625var util = require ( 'core-util-is' ) ;
2726util . inherits = require ( 'inherits' ) ;
@@ -35,46 +34,42 @@ util.inherits(Duplex, Readable);
3534var keys = objectKeys ( Writable . prototype ) ;
3635for ( var v = 0 ; v < keys . length ; v ++ ) {
3736 var method = keys [ v ] ;
38- if ( ! Duplex . prototype [ method ] )
39- Duplex . prototype [ method ] = Writable . prototype [ method ] ; }
40-
37+ if ( ! Duplex . prototype [ method ] ) Duplex . prototype [ method ] = Writable . prototype [ method ] ;
38+ }
4139
4240function Duplex ( options ) {
43- if ( ! ( this instanceof Duplex ) )
44- return new Duplex ( options ) ;
41+ if ( ! ( this instanceof Duplex ) ) return new Duplex ( options ) ;
4542
4643 Readable . call ( this , options ) ;
4744 Writable . call ( this , options ) ;
4845
49- if ( options && options . readable === false )
50- this . readable = false ;
46+ if ( options && options . readable === false ) this . readable = false ;
5147
52- if ( options && options . writable === false )
53- this . writable = false ;
48+ if ( options && options . writable === false ) this . writable = false ;
5449
5550 this . allowHalfOpen = true ;
56- if ( options && options . allowHalfOpen === false )
57- this . allowHalfOpen = false ;
58-
59- this . once ( 'end' , onend ) ; }
51+ if ( options && options . allowHalfOpen === false ) this . allowHalfOpen = false ;
6052
53+ this . once ( 'end' , onend ) ;
54+ }
6155
6256// the no-half-open enforcer
6357function onend ( ) {
6458 // if we allow half-open state, or if the writable side ended,
6559 // then we're ok.
66- if ( this . allowHalfOpen || this . _writableState . ended )
67- return ;
60+ if ( this . allowHalfOpen || this . _writableState . ended ) return ;
6861
6962 // no more data can be written.
7063 // But allow more writes to happen in this tick.
71- processNextTick ( onEndNT , this ) ; }
72-
64+ processNextTick ( onEndNT , this ) ;
65+ }
7366
7467function onEndNT ( self ) {
75- self . end ( ) ; }
76-
68+ self . end ( ) ;
69+ }
7770
7871function forEach ( xs , f ) {
7972 for ( var i = 0 , l = xs . length ; i < l ; i ++ ) {
80- f ( xs [ i ] , i ) ; } }
73+ f ( xs [ i ] , i ) ;
74+ }
75+ }
0 commit comments