@ng-doc/builder
Version:
<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>
29 lines • 977 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.joinBuilderStates = joinBuilderStates;
const core_1 = require("@ng-doc/core");
const rxjs_1 = require("rxjs");
const types_1 = require("../types");
/**
*
* @param tag
* @param states
* @param project
*/
function joinBuilderStates(tag, states, project) {
/**
* If any of the states are pending, return an Observable of BuilderPending.
*/
if (states.some(types_1.isBuilderPending)) {
return (0, rxjs_1.of)(new types_1.BuilderPending(tag));
}
const errors = states.filter(types_1.isBuilderError);
/**
* If there are any errors in the states, return an Observable of BuilderError.
*/
if (errors.length) {
return (0, rxjs_1.of)(new types_1.BuilderError(tag, (0, core_1.asArray)(...errors.map(({ error }) => error))));
}
return project(...states.map(({ result }) => result));
}
//# sourceMappingURL=join-builder-states.js.map
;