Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cart-localstorage

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cart-localstorage

Tiny shopping cart on top of LolcalStorage - ES6, < 1Kb, test coverage

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
318
decreased by-22.63%
Maintainers
1
Weekly downloads
 
Created
Source

cart-localstorage

Super Simple Shopping Cart on top of browser localStorage with a very small footprint (~1Kb, 0 dependencies)

Demo

//todo add codepen demo

INSTALL:

This is a JavaScript ES6 library. Use npm or yarn to add it to your project:

npm install cart-localstorage

or 

yarn install cart-localstorage

How to start?

import Cart from 'cart-localstorage' 

Cart.add({id: 1, name: "Product 1", price: 100},1)

console.log(Cart.total()) 
// output: 100

...

## API

list()

Array of products in the cart.

list()
// output:  [{id: 1, name: "Nike Air", price: 100, quantity: 1}, {id: 1, name: "Adidas Superstar", price: 120, quantity: 2}]
get()

Get product by id

get(1)
// output:  [{id: 1, name: "Nike Air", price: 100, quantity: 1}]
add()

Adds product into the cart. If a product exists with the same increases the quantity only.

add({id: 3, name: "Vans", price: 75, quantity: 2})
remove()

Removes product by id

remove(1)
update(,)

Updates the product quantity on a specific product

update(1,5)

total()

detroy()




## License

This plugin is available under Apache 2.0 license.

Keywords

FAQs

Package last updated on 31 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc