mirror of https://github.com/lidarr/Lidarr
18 lines
456 B
JavaScript
18 lines
456 B
JavaScript
import { createSelector } from 'reselect';
|
|
import getSectionState from 'Utilities/State/getSectionState';
|
|
|
|
function createSortedSectionSelector(section, comparer) {
|
|
return createSelector(
|
|
(state) => state,
|
|
(state) => {
|
|
const sectionState = getSectionState(state, section, true);
|
|
return {
|
|
...sectionState,
|
|
items: [...sectionState.items].sort(comparer)
|
|
};
|
|
}
|
|
);
|
|
}
|
|
|
|
export default createSortedSectionSelector;
|