import { createSelector } from 'reselect' ; import { IStorageDestinationItem } from '../../interfaces' ; import { IApplicationState } from '../index' ; export function getStorageDestinations ( state ) { return state . storageDestinations . destinations ?? [ ] ; } export const getStorageDestinationsById = createSelector < IApplicationState , Array < IStorageDestinationItem > , Dictionary < string , IStorageDestinationItem > > ( [ getStorageDestinations ] , ( destinations ) => { return destinations . reduce < Dictionary < string , IStorageDestinationItem > > ( ( items , destination ) => { items [ destination . _id ] = destination ; return items ; } , { } ) ; } ) ;