Passed
Push — feature/connect-application-st... ( a6f23b...9d3dc6 )
by Chris
04:02
created

resources/assets/js/store/Skill/skillSelector.ts   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 17
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 1
mnd 1
bc 1
fnc 0
bpm 0
cpm 0
noi 0
1
import { createSelector } from "reselect";
2
import { Skill } from "../../models/types";
3
import { RootState } from "../store";
4
import { hasKey } from "../../helpers/queries";
5
6
export const getSkillState = (state: RootState): { [id: number]: Skill } =>
7
  state.skill.entities.skills.byId;
8
9
export const getSkills = createSelector(getSkillState, (skillState): Skill[] =>
10
  Object.values(skillState),
11
);
12
13
export const getSkillById = (state: RootState, id: number): Skill | null =>
14
  hasKey(state.skill.entities.skills.byId, id)
15
    ? state.skill.entities.skills.byId[id]
16
    : null;
17