All files / src/persistence util.ts

85.71% Statements 6/7
0% Branches 0/1
100% Functions 2/2
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10  41x   41x 41x 843x 8x 8x    
import { CollectionStore } from './types';
import { EMPTY, Subject, concat, defaultIfEmpty, race } from 'rxjs';
 
export const observeAll =
  <T>(store: CollectionStore<T>, updates$: Subject<T[]>) =>
  () => {
    Iif (store.destroyed) return EMPTY;
    return race(concat(store.getAll().pipe(defaultIfEmpty([])), updates$), updates$);
  };