Passed
Push — dev ( 7438a7...58478a )
by Tristan
10:42 queued 05:17
created

resources/assets/js/store/JobPosterStatus/jobStatusSelector.ts   A

Complexity

Total Complexity 2
Complexity/F 0

Size

Lines of Code 18
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 17
c 0
b 0
f 0
dl 0
loc 18
rs 10
mnd 2
bc 2
fnc 0
bpm 0
cpm 0
noi 0
1
import { RootState } from "../store";
2
import { JobPosterStatus } from "../../models/types";
3
import { JobStatusState } from "./jobStatusReducer";
4
5
export const getJobStatusState = (state: RootState): JobStatusState =>
6
  state.jobStatuses;
7
8
export const getJobStatuses = (state: RootState): JobPosterStatus[] =>
9
  Object.values(getJobStatusState(state).byId);
10
11
export const getJobStatusById = (
12
  state: RootState,
13
  { statusId }: { statusId: number },
14
): JobPosterStatus | null => getJobStatusState(state).byId[statusId] ?? null;
15
16
export const jobStatusesLoading = (state: RootState): boolean =>
17
  getJobStatusState(state).loading;
18