/** * WordPress dependencies */ import { createSelector } from '@safe-wordpress/data'; /** * External dependencies */ import { keys, values } from 'lodash'; import type { Feed, FeedId, Maybe } from '@nelio-content/types'; /** * Internal dependencies */ import type { State } from '../../config'; export function getFeed( state: State, feedId: FeedId ): Maybe< Feed > { return state.entities.feeds[ feedId ]; } export const getFeeds = createSelector( ( state: State ): ReadonlyArray< Feed > => { return values( state.entities.feeds ); }, ( state: State ) => [ state.entities.feeds ] ); export const getFeedIds = createSelector( ( state: State ): ReadonlyArray< FeedId > => { return keys( state.entities.feeds ); }, ( state: State ) => [ state.entities.feeds ] );