@bemedev/rx-add-ons
Version:
A collection of RxJS operators and utilities to enhance reactive programming capabilities.
22 lines (18 loc) • 519 B
JavaScript
;
var tap = require('rxjs/internal/operators/tap');
function tapWhile(predicate, sideEffect) {
return (source) => {
const all = [];
let index = 0;
return source.pipe(tap.tap(value => {
all.push(value);
}), tap.tap(value => {
const check = predicate(value, index, all);
if (check)
sideEffect(value, index, all);
index++;
}));
};
}
exports.tapWhile = tapWhile;
//# sourceMappingURL=tap.cjs.map