Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
* **v0.0.1, unstable,** Simple api to store data for shopping carts, wishlists in browser localstorage
npm install stampit
require('local-cart'); //add cart factory to window object
const myCart = window.cartFactory({
name: 'myAwesomeShopCart'
})
name
name is used to store data in local storage, to restore cart with previuosly saved dataid
- item identificator in cartcount
- number of items in cart, if not specified is 1
unit_price
- price of 1 item in cartdata
- this is place to store your product model data, api doesn't use it,var myProductModel = {
id: 1,
price:1000,
title: 'Interesting Book',
author: 'Jogn Doe'
}
var newCartItemOptions = {
id: myProductModel.id,
unit_price: myProductModel.price,
data: myProductModel
}
myCart.addItem(newCartItemOptions);
Adding product with id
that already exists in cart only updates count
of an item
myCart.addItem(newCartItemOptions);
console.log(myCart.items); // [Object]
console.log(myCart.getTotalCount); // 1
// add same item again
myCart.addItem(newCartItemOptions);
console.log(myCart.items); // [Object]
console.log(myCart.getTotalCount); // 2
// let's change count property
newCartItemOptions.count = 8;
myCart.addItem(newCartItemOptions);
console.log(myCart.items); // [Object]
console.log(myCart.getTotalCount); // 10
Returns item with given id
Update count
of existing item in cart
Delete item from cart
Total price of all items.
Total count of all items.
Cart object is also an event emmiter. By now it emits
only one event. See node event emmiter api
change
- fires when anything in cart is changed, after addItem
, deleteItem
, updateItemCount
methodsmyCart.on('change', functon () {
console.log('items changed');
});
FAQs
* **v0.0.1, unstable,** Simple api to store data for shopping carts, wishlists in browser localstorage
The npm package local-cart receives a total of 2 weekly downloads. As such, local-cart popularity was classified as not popular.
We found that local-cart demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.