Passed
Push — feature/azure-webapp-pipeline-... ( 5f3462...4237ea )
by Grant
04:59
created

resources/assets/js/store/EducationStatus/educationStatusSelector.ts   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 23
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 21
mnd 1
bc 1
fnc 0
dl 0
loc 23
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
rs 10
1
import { createSelector } from "reselect";
2
import { RootState } from "../store";
3
import { EducationStatus } from "../../models/types";
4
import { hasKey } from "../../helpers/queries";
5
6
export const getEducationStatusState = (
7
  state: RootState,
8
): { [id: number]: EducationStatus } => state.educationStatus.byId;
9
10
export const getEducationStatuses = createSelector(
11
  getEducationStatusState,
12
  (awardRecognitionTypeState): EducationStatus[] =>
13
    Object.values(awardRecognitionTypeState),
14
);
15
16
export const getEducationStatusById = (
17
  state: RootState,
18
  id: number,
19
): EducationStatus | null =>
20
  hasKey(getEducationStatusState(state), id)
21
    ? getEducationStatusState(state)[id]
22
    : null;
23