Conditional Activation of an Observable
Only make an observable run based on a ternary matching criteria.
// Third party modules
import { NEVER, of } from 'rxjs';
const evaluateToTrueCriteria = true;
// 'conditional$' will not run 'subscribe' when the ternary
// evaluates to the false branch
const conditional$ = evaluateToTrueCriteria ? of(true) : NEVER;
conditional$.subscribe((res) => console.log(res));