Skip to content

Commit

Permalink
feat(clear): add 'clear' method
Browse files Browse the repository at this point in the history
  • Loading branch information
leomp12 committed Aug 29, 2019
1 parent 26206b9 commit 7752491
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/methods/clear.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export default ({ cart, save }) => {
// empty the items array and save
cart.items = []
return save()
}

/**
* @method
* @name EcomCart#clear
* @description Remove all items from cart and save.
*
* @returns {self}
*
* @example
cart.clear()
*/

0 comments on commit 7752491

Please # to comment.