All files / src/app/core/store/content/parameters parameters.selectors.ts

100% Statements 12/12
100% Branches 0/0
100% Functions 5/5
100% Lines 8/8

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 11 12 13 14 1519x   19x 19x   19x   19x   19x 2x   2x    
import { createSelector, createSelectorFactory, resultMemoize } from '@ngrx/store';
 
import { getContentState } from 'ish-core/store/content/content-store';
import { isArrayEqual } from 'ish-core/utils/functions';
 
const getParametersState = createSelector(getContentState, state => state.parameters);
 
const getParametersProductLists = createSelector(getParametersState, parameters => parameters.productLists);
 
export const getParametersProductList = (id: string) =>
  createSelectorFactory<object, string[]>(projector => resultMemoize(projector, isArrayEqual))(
    getParametersProductLists,
    (productLists: { [id: string]: string[] }): string[] => productLists[id]
  );