diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-10-04 22:49:07 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-10-04 22:49:25 +0200 |
| commit | 751a9ef3a12c952fe179f256d854d0c4aa37e28e (patch) | |
| tree | 241fc22c592a277526e73cc70ea0f95d5a8a7b29 /src/reducers/states.js | |
| parent | 9257d89ec2e22b65ffecc7dc7cf67b7a74c34d60 (diff) | |
Apply prettier to codebase
Diffstat (limited to 'src/reducers/states.js')
| -rw-r--r-- | src/reducers/states.js | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/src/reducers/states.js b/src/reducers/states.js index 81f078af..793f7b7d 100644 --- a/src/reducers/states.js +++ b/src/reducers/states.js @@ -1,37 +1,33 @@ -import {combineReducers} from "redux"; -import {ADD_BATCH_TO_STATES} from "../actions/states"; +import { combineReducers } from "redux"; +import { ADD_BATCH_TO_STATES } from "../actions/states"; export const states = combineReducers({ - task: objectStates("task"), - room: objectStates("room"), - rack: objectStates("rack"), - machine: objectStates("machine"), + task: objectStates("task"), + room: objectStates("room"), + rack: objectStates("rack"), + machine: objectStates("machine") }); function objectStates(type) { - return (state = {}, action) => { - if (action.objectType !== type) { - return state; - } + return (state = {}, action) => { + if (action.objectType !== type) { + return state; + } - if (action.type === ADD_BATCH_TO_STATES) { - const batch = {}; - for (let i in action.objects) { - batch[action.objects[i].tick] = Object.assign( - {}, - state[action.objects[i].tick], - batch[action.objects[i].tick], - {[action.objects[i][action.objectType + "Id"]]: action.objects[i]} - ); - } + if (action.type === ADD_BATCH_TO_STATES) { + const batch = {}; + for (let i in action.objects) { + batch[action.objects[i].tick] = Object.assign( + {}, + state[action.objects[i].tick], + batch[action.objects[i].tick], + { [action.objects[i][action.objectType + "Id"]]: action.objects[i] } + ); + } - return Object.assign( - {}, - state, - batch - ); - } + return Object.assign({}, state, batch); + } - return state; - }; + return state; + }; } |
