hyper/lib/selectors.ts
2023-07-25 15:34:59 +05:30

9 lines
367 B
TypeScript

import {createSelector} from 'reselect';
import type {HyperState} from '../typings/hyper';
const getTermGroups = ({termGroups}: Pick<HyperState, 'termGroups'>) => termGroups.termGroups;
export const getRootGroups = createSelector(getTermGroups, (termGroups) =>
Object.keys(termGroups)
.map((uid) => termGroups[uid])
.filter(({parentUid}) => !parentUid)
);