You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
452 B
22 lines
452 B
6 years ago
|
import _ from 'lodash';
|
||
|
import { update } from 'Store/Actions/baseActions';
|
||
|
|
||
|
function updateEpisodes(section, episodes, episodeIds, options) {
|
||
|
const data = _.reduce(episodes, (result, item) => {
|
||
|
if (episodeIds.indexOf(item.id) > -1) {
|
||
|
result.push({
|
||
|
...item,
|
||
|
...options
|
||
|
});
|
||
|
} else {
|
||
|
result.push(item);
|
||
|
}
|
||
|
|
||
|
return result;
|
||
|
}, []);
|
||
|
|
||
|
return update({ section, data });
|
||
|
}
|
||
|
|
||
|
export default updateEpisodes;
|