every.js 598 B

1234567891011121314151617
  1. import { operate } from '../util/lift';
  2. import { createOperatorSubscriber } from './OperatorSubscriber';
  3. export function every(predicate, thisArg) {
  4. return operate((source, subscriber) => {
  5. let index = 0;
  6. source.subscribe(createOperatorSubscriber(subscriber, (value) => {
  7. if (!predicate.call(thisArg, value, index++, source)) {
  8. subscriber.next(false);
  9. subscriber.complete();
  10. }
  11. }, () => {
  12. subscriber.next(true);
  13. subscriber.complete();
  14. }));
  15. });
  16. }
  17. //# sourceMappingURL=every.js.map