All files / src/utils object.ts

100% Statements 13/13
100% Branches 4/4
100% Functions 1/1
100% Lines 13/13

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 15 16    1x 3x 3x 3x 3x 3x 3x 3x 12x 12x 3x 3x 3x  
import { ChartMode } from '@/types';
 
export const createObjectMap = <T>(
  chartModes: typeof ChartMode,
  storedFilters: Record<string, any>,
  defaultMap: Record<string, T>,
  key: string,
): Record<string, T> => {
  return Object.fromEntries(
    Object.values(chartModes).map((mode) => [
      mode,
      storedFilters[mode]?.[key] ?? defaultMap[mode],
    ]),
  );
};