@matheo/ng-packagr
Version:
Compile and package Angular libraries in Angular Package Format (APF)
16 lines • 671 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.transformFromPromise = void 0;
const rxjs_1 = require("rxjs");
const operators_1 = require("rxjs/operators");
const transformFromPromise = (transformFn) => rxjs_1.pipe(operators_1.switchMap(graph => {
const transformResult = transformFn(graph);
if (transformResult instanceof Promise) {
return rxjs_1.from(transformResult).pipe(operators_1.map(result => (result ? result : graph)));
}
else {
return rxjs_1.of(transformResult ? transformResult : graph);
}
}));
exports.transformFromPromise = transformFromPromise;
//# sourceMappingURL=transform.js.map