every
연산자(operator) 정의: every(predicate: function, thisArg: any): Observable
If all values pass predicate before completion emit true, else false.
Examples
Example 1: Some values false
//emit 5 values
const source = Rx.Observable.of(1,2,3,4,5);
const example = source
//is every value even?
.every(val => val % 2 === 0)
//output: false
const subscribe = example.subscribe(val => console.log(val));
Example 2: All values true
//emit 5 values
const allEvens = Rx.Observable.of(2,4,6,8,10);
const example = allEvens
//is every value even?
.every(val => val % 2 === 0);
//output: true
const subscribe = example.subscribe(val => console.log(val));
Additional Resources
- every - Official docs
Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/operator/every.ts