File tree Expand file tree Collapse file tree 1 file changed +3
-22
lines changed Expand file tree Collapse file tree 1 file changed +3
-22
lines changed Original file line number Diff line number Diff line change @@ -3,46 +3,27 @@ var noop = function () {}
3
3
module . exports = function ( next ) {
4
4
var stream
5
5
return function ( abort , cb ) {
6
+ if ( ! cb ) throw new Error ( 'callback required!' )
6
7
if ( abort ) {
7
8
if ( stream ) stream ( abort , cb )
8
9
else cb ( abort )
9
10
}
10
- else
11
- more ( )
12
-
13
- function more ( ) {
11
+ else ( function more ( ) {
14
12
if ( ! stream ) {
15
13
try { stream = next ( ) }
16
14
catch ( err ) { return cb ( err ) }
17
15
if ( ! stream ) return cb ( true )
18
16
}
19
17
stream ( null , function ( err , data ) {
20
18
if ( err ) {
21
- console . log ( 'end' , err , data )
22
19
stream = null
23
20
if ( err === true ) setTimeout ( more , 100 )
24
21
else cb ( err )
25
22
}
26
23
else
27
24
cb ( null , data )
28
25
} )
29
- }
26
+ } ) ( )
30
27
}
31
28
}
32
29
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
You can’t perform that action at this time.
0 commit comments