Skip to content

Instantly share code, notes, and snippets.

@tchalvak
Created February 10, 2017 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tchalvak/0ebd5c843ffbf0aabf4c08b3f88d7804 to your computer and use it in GitHub Desktop.
Save tchalvak/0ebd5c843ffbf0aabf4c08b3f88d7804 to your computer and use it in GitHub Desktop.
function series(state = {}, action) {
switch (action.type) {
case RECEIVE_SERIES_DATA:
const series = action.data.length ? action.data : [action.data]
return series.reduce((acc, series) => {
return Object.assign({}, acc, { [series.unique_key] : series })
}, state)
default:
return state
}
return state
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment