const getVisibleExpenses = (expenses, { text, sortBy, startDate, endDate }) => {
return expenses.filter((expense) => {
const startDateMatch = typeof startDate !== "number" || expense.createAt >= startDate;
const endDateMatch = typeof endDate !== "number" || expense.createAt <= endDate;
const textMatch = expense.desciption.toLowerCase().includes(text.toLowerCase())
return startDateMatch && endDateMatch && textMatch;
});
}
const store = createStore(combineReducers({
expenses: expensesReducer,
filters: filterReducer
}))
store.subscribe(() => {
const state = store.getState();
const visibleExpense = getVisibleExpenses(state.expenses, state.filters);
console.log(visibleExpense);
})
can any one help me to describe this code particularly in this section i got the expenses and object from the redux store which are the reducer but i could not understand the logic of below code
const startDateMatch = typeof startDate !== "number" || expense.createAt >= startDate;