frontend/.pnpm-store/v3/files/db/773e7c9b90ffe60456710cc0b9c5edd62c9460227e348ede90f7095542fdad8124951e0588464fc5aa443550da589d416423da6462f465d3ac27cf91d9e6d2

45 lines
1.3 KiB
Plaintext

import { Subscriber } from '../Subscriber';
export function every(predicate, thisArg) {
return (source) => source.lift(new EveryOperator(predicate, thisArg, source));
}
class EveryOperator {
constructor(predicate, thisArg, source) {
this.predicate = predicate;
this.thisArg = thisArg;
this.source = source;
}
call(observer, source) {
return source.subscribe(new EverySubscriber(observer, this.predicate, this.thisArg, this.source));
}
}
class EverySubscriber extends Subscriber {
constructor(destination, predicate, thisArg, source) {
super(destination);
this.predicate = predicate;
this.thisArg = thisArg;
this.source = source;
this.index = 0;
this.thisArg = thisArg || this;
}
notifyComplete(everyValueMatch) {
this.destination.next(everyValueMatch);
this.destination.complete();
}
_next(value) {
let result = false;
try {
result = this.predicate.call(this.thisArg, value, this.index++, this.source);
}
catch (err) {
this.destination.error(err);
return;
}
if (!result) {
this.notifyComplete(false);
}
}
_complete() {
this.notifyComplete(true);
}
}
//# sourceMappingURL=every.js.map