E-commerce simulator
a simple package with functions to manage a product array
Install
$ npm install fake-e-commerce
Usage
var products = ;
Get all the products from your array with get()
.
products;
Get a product by id with getProductById(id)
.
products;
Add a new product with addProduct(name, quantity, price)
. The package will automatically assign an id to the new product.
products;
Delete a product by id with deleteProduct(id)
.
products;
Buy a product by id product and token with buy(id, token)
. The package will automatically assign an id to the new product. later through the api you can manage the permissions.
products;
Modify a product with updateProduct(name, quantity, price)
. you can modify even just one of the properties.
products;
Get all sales products with soldProducts()
.
products;
Get all products bought by an user through his token soldProducts()
.
products;
Reset original product array with reset()
.
products;