export function cart(state) {
    return state.cart;
  }
  export function  isCartEmpty(state){
    return  state.cart.length==0 ? true : false;
  }

  export function  rate(state){
    return  state.rate;
  }
  export function  currency(state){
    return  state.currency;
  }
  export function  totalCartItems(state){
    return  state.cart.length;
  }

  export function  cartTotal(state){
    return state.cart.map((val, index) => {
      return state.rate*parseFloat(val.price - val.discount);
    }).reduce((acc,val)=>{
      return acc+val;
    },0)
  }
