Total Complexity | 1 |
Complexity/F | 0 |
Lines of Code | 19 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { createSelector } from "reselect"; |
||
2 | import { RootState } from "../store"; |
||
3 | import { Classification } from "../../models/types"; |
||
4 | import { hasKey } from "../../helpers/queries"; |
||
5 | |||
6 | export const getClassificationState = (state: RootState): { [key: string]: Classification } => |
||
7 | state.classification.byId; |
||
8 | |||
9 | export const getClassifications = createSelector( |
||
10 | getClassificationState, |
||
11 | (ClassificationState): Classification[] => Object.values(ClassificationState), |
||
12 | ); |
||
13 | |||
14 | export const getClassificationById = ( |
||
15 | state: RootState, |
||
16 | id: number, |
||
17 | ): Classification | null => |
||
18 | hasKey(getClassificationState(state), id) ? getClassificationState(state)[id] : null; |
||
19 | |||
20 |