@@ -29,13 +29,6 @@ module.exports = function f (b, opts) {
29
29
30
30
var outopt = defined ( opts . outputs , opts . output , opts . o ) ;
31
31
32
- function moreOutputs ( file ) {
33
- if ( isarray ( outopt ) ) return [ ] ;
34
- if ( ! outopt ) return [ ] ;
35
- var xopts = { env : xtend ( process . env , { FILE : file } ) } ;
36
- return [ outpipe ( outopt , xopts ) ] ;
37
- }
38
-
39
32
opts . objectMode = true ;
40
33
opts . raw = true ;
41
34
opts . rmap = { } ;
@@ -56,20 +49,27 @@ module.exports = function f (b, opts) {
56
49
}
57
50
next ( null , row ) ;
58
51
} , function ( next ) {
59
- if ( outopt && ! isarray ( outopt ) && ! typeof outputs === 'function' ) outopt = [ outopt ] ;
60
- var outputs = defined ( outopt , [ ] ) ;
61
-
62
- if ( typeof outputs === 'function' ) {
63
- outputs = outputs ( ) ;
64
- } else if ( ! isarray ( outputs ) && isStream ( outputs ) ) {
65
- outputs = [ outputs ] ;
66
- } else if ( ! isarray ( outputs ) ) {
67
- outputs = [ ] ;
68
- } else {
69
- outputs = outputs . map ( function ( o ) {
52
+ var outopt = defined ( opts . outputs , opts . output , opts . o ) ;
53
+
54
+ if ( typeof outopt === 'function' ) {
55
+ outopt = outopt ( ) ;
56
+ }
57
+
58
+ var outputs ;
59
+ if ( isarray ( outopt ) ) {
60
+ outputs = outopt . map ( function ( o ) {
70
61
if ( isStream ( o ) ) return o ;
71
- else return fs . createWriteStream ( o ) ;
62
+ return fs . createWriteStream ( o ) ;
72
63
} ) ;
64
+ } else {
65
+ outputs = [ ] ;
66
+ }
67
+
68
+ function moreOutputs ( file ) {
69
+ if ( isarray ( outopt ) ) return [ ] ;
70
+ if ( ! outopt ) return [ ] ;
71
+ var xopts = { env : xtend ( process . env , { FILE : file } ) } ;
72
+ return [ outpipe ( outopt , xopts ) ] ;
73
73
}
74
74
75
75
var pipelines = files . reduce ( function ( acc , x , ix ) {
0 commit comments