Skip to content

Commit

Permalink
feat: Renamed StoreOptions.stateComparator to `StoreOptions.compara…
Browse files Browse the repository at this point in the history
…tor`
  • Loading branch information
mnasyrov committed Nov 7, 2022
1 parent d22b264 commit 11442f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/rx-effects/src/store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Store', () => {
it('should use a custom "stateCompare" predicate', async () => {
const store = createStore<State>(
{ value: 1, data: 'a' },
{ stateComparator: (s1, s2) => s1.value === s2.value },
{ comparator: (s1, s2) => s1.value === s2.value },
);

const changes = await collectChanges(store.value$, () => {
Expand Down Expand Up @@ -308,7 +308,7 @@ function createTestStore<State>(
const patch =
(partial: Partial<State>) =>
(state: State): State => ({ ...state, ...partial });
const store = createStore(initialState, { stateComparator: comparator });
const store = createStore(initialState, { comparator: comparator });

const history: State[] = [];
store.value$.subscribe((state) => history.push(state));
Expand Down
4 changes: 2 additions & 2 deletions packages/rx-effects/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export type StoreOptions<State> = Readonly<{
name?: string;

/** A comparator for detecting changes between old and new states */
stateComparator?: (prevState: State, nextState: State) => boolean;
comparator?: (prevState: State, nextState: State) => boolean;

/** @internal */
internal?: boolean;
Expand All @@ -93,7 +93,7 @@ export function createStore<State>(
initialState: State,
options?: StoreOptions<State>,
): Store<State> {
const stateComparator = options?.stateComparator ?? DEFAULT_COMPARATOR;
const stateComparator = options?.comparator ?? DEFAULT_COMPARATOR;

const store$: BehaviorSubject<State> = new BehaviorSubject(initialState);
const state$ = store$.asObservable();
Expand Down

0 comments on commit 11442f6

Please sign in to comment.