// RxJS v6+import { every } from'rxjs/operators';import { of } from'rxjs';//emit 5 valuesconstsource=of(1,2,3,4,5);constexample=source.pipe(//is every value even?every(val => val %2===0));//output: falseconstsubscribe=example.subscribe(val =>console.log(val));
// RxJS v6+import { every } from'rxjs/operators';import { of } from'rxjs';//emit 5 valuesconstallEvens=of(2,4,6,8,10);constexample=allEvens.pipe(//is every value even?every(val => val %2===0));//output: trueconstsubscribe=example.subscribe(val =>console.log(val));
Example 3: Values arriving over time and completing stream prematurely due to every returning false