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.
18 lines
375 B
18 lines
375 B
6 years ago
|
import _ from 'lodash';
|
||
|
|
||
|
function selectAll(selectedState, selected) {
|
||
|
const newSelectedState = _.reduce(Object.keys(selectedState), (result, item) => {
|
||
|
result[item] = selected;
|
||
|
return result;
|
||
|
}, {});
|
||
|
|
||
|
return {
|
||
|
allSelected: selected,
|
||
|
allUnselected: !selected,
|
||
|
lastToggled: null,
|
||
|
selectedState: newSelectedState
|
||
|
};
|
||
|
}
|
||
|
|
||
|
export default selectAll;
|