Skip to content

Commit 3cc6986

Browse files
committed
allow outputs as function
1 parent 18692d6 commit 3cc6986

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

index.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,22 @@ module.exports = function f (b, opts) {
6767
}
6868
next(null, row);
6969
}, function(next) {
70+
var outputResult;
71+
72+
if (typeof outputs === 'function') {
73+
outputResult = outputs();
74+
} else outputResult = outputs;
75+
7076
var pipelines = files.reduce(function (acc, x, ix) {
7177
var pipeline = splicer.obj([
7278
'pack', [ pack(packOpts) ],
7379
'wrap', []
7480
]);
75-
if (typeof outputs === 'function') {
76-
pipeline.pipe(outputs(x))
77-
} else {
78-
if (ix >= outputs.length) {
79-
outputs.push.apply(outputs, moreOutputs(x));
80-
}
81-
if (outputs[ix]) pipeline.pipe(outputs[ix]);
81+
82+
if (ix >= outputResult.length) {
83+
outputResult.push.apply(outputResult, moreOutputs(x));
8284
}
85+
if (outputResult[ix]) pipeline.pipe(outputResult[ix]);
8386

8487
acc[path.resolve(cwd, x)] = pipeline;
8588
return acc;

0 commit comments

Comments
 (0)