mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
23 lines
485 B
JavaScript
23 lines
485 B
JavaScript
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;
|