Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame
411 Bytes
import { createSelector } from 'reselect'
import type { RootState } from './firstPattern'
const EMPTY_ARRAY: [] = []
export const fallbackToEmptyArray = <T>(array: T[]) => {
return array.length === 0 ? EMPTY_ARRAY : array
}
const selectCompletedTodos = createSelector(
[(state: RootState) => state.todos],
todos => {
return fallbackToEmptyArray(todos.filter(todo => todo.completed === true))
}
)