refactor: always return an Array of results/errors from a plugin pipeline
Always return an `Array` from a pipeline simplify the function utilization as it's more deterministic. Previously, it would return/throw a single value/error when called with a single input and an `Array` of results/errors when called with an `Array` of input.
This commit is contained in:
@@ -49,7 +49,7 @@ module.exports = steps => async (input, {settleAll = false, getNextInput = ident
|
||||
input
|
||||
);
|
||||
if (errors.length > 0) {
|
||||
throw errors.length === 1 ? errors[0] : new AggregateError(errors);
|
||||
throw new AggregateError(errors);
|
||||
}
|
||||
return results.length <= 1 ? results[0] : results;
|
||||
return results;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user