11 lines
360 B
TypeScript
11 lines
360 B
TypeScript
import { D } from '@mobily/ts-belt';
|
|
|
|
export function buildSelectors(localSelectors = {}, subduxes = {}) {
|
|
const subSelectors = (Object.entries(subduxes) as any).map(
|
|
([slice, { selectors }]) =>
|
|
D.map(selectors, (subSelect) => (state) => subSelect(state[slice])),
|
|
);
|
|
|
|
return [localSelectors, ...subSelectors].reduce(D.merge);
|
|
}
|