0.2.0 • Published 7 years ago

react-cart v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Build Status Coverage Status npm version

Item Interface: An item must have the following properties:

  • name: The name of the item
  • cost: The numeric cost of the item. In totalling, all costs will be rounded to two decimal places.
  • id: An identifier for the particular item. Can either be unique to the item, or unique to all items of the same type, ie all "apple" items could have the same id, or each "apple" could have its own id.

Shopping Cart Data Functions:

  • cart() - Returns the list of items currently in the cart.
  • add({item: item}) - Adds an item to the cart.
  • remove({id: itemId}) OR remove({index: itemIndex}) - Removes an item by index or itemId from the cart.
  • total() - Returns the total numeric cost of all items in the cart.
  • clear() - Removes all items from the cart.

React-esque functions:

  • mount(element) - Mounts the shopping cart to the provided DOM element.
  • component - Returns a react element for the shopping cart. This can either be rendered with reactDom.render() or be used within component tree.
0.2.0

7 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.2

9 years ago

0.0.1

9 years ago