- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
export const getBasketProductsWithCount = state => {
const productCount = id => R.compose(
R.length,
R.filter(basketId => R.equals(id, basketId.id))
)(state.basket);
const productWithCount = product => R.assoc('count', productCount(product.id), product);
const uniqueIds = R.uniq(state.basket);
const products = R.compose(
R.map(productWithCount),
R.map(id => id)
)(uniqueIds);
return products;
};
Комментарии (0) RSS
Добавить комментарий