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.
Lidarr/frontend/src/Utilities/State/getSectionState.js

23 lines
485 B

import _ from 'lodash';
function getSectionState(state, section, isFullStateTree = false) {
if (isFullStateTree) {
return _.get(state, section);
}
const [, subSection] = section.split('.');
if (subSection) {
return Object.assign({}, state[subSection]);
}
// TODO: Remove in favour of using subSection
if (state.hasOwnProperty(section)) {
return Object.assign({}, state[section]);
}
return Object.assign({}, state);
}
export default getSectionState;