import { createSelector } from 'reselect' ; const getImages = images => images ; const getVisibleCategories = state => { let noOfVisibleCategories = 0 ; for ( let category of state . categories ) { if ( category . visible ) noOfVisibleCategories += 1 ; } return noOfVisibleCategories ; } ; export const selectVisibleImages = state => { let result = { } ; for ( let key in state . images ) { if ( state . images [ key ] . visible ) result [ key ] = state . images [ key ] ; } return result ; } ; export const getVisibleImages = createSelector ( [ getImages , getVisibleCategories ] , images => selectVisibleImages ( images ) ) ; export default getVisibleImages ;