Basic Cart
Install
npm
npm i basic-cart -S
Usage
import Cart from 'basic-cart';
const cart = new Cart()
const product = {id:'123',name:"Apple",price:'2.56'}
Add Product
cart.add(product)
Remove Product
cart.remove(product)
Count items
cart.count()
Get items as an array
cart.getItems()
Calculate Total
cart.total()
Calculate Total For Product
cart.totalForProduct(product)
Reset Items
cart.reset()