diff options
author | Noah Loomans <noahloomans@gmail.com> | 2018-01-28 19:11:00 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2018-01-28 19:11:00 +0100 |
commit | 7dd214d57c7dab9626abef1516a862f46c1e02bd (patch) | |
tree | 9fb9c0060d0e595550a064caa4efb4289d2b7eb8 /src/client/react/lib | |
parent | 9f438225db07b7214e4a41d133634309cba80073 (diff) |
Refactor View.js
Diffstat (limited to 'src/client/react/lib')
-rw-r--r-- | src/client/react/lib/extractSchedule.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/client/react/lib/extractSchedule.js b/src/client/react/lib/extractSchedule.js new file mode 100644 index 0000000..e74411b --- /dev/null +++ b/src/client/react/lib/extractSchedule.js @@ -0,0 +1,10 @@ +export default function extractSchedule(schedules, user, week) { + const scheduleExists = + schedules.hasOwnProperty(user) && schedules[user].hasOwnProperty(week); + + if (!scheduleExists) { + return { state: 'NOT_REQUESTED' }; + } + + return schedules[user][week]; +} |