fake-e-commerce

1.0.10 • Public • Published

E-commerce simulator

a simple package with functions to manage a product array

Install

$ npm install fake-e-commerce

Usage

var products = require('fake-e-commerce');

Get all the products from your array with get().

products.get();

Get a product by id with getProductById(id).

products.getProductById(id);

Add a new product with addProduct(name, quantity, price). The package will automatically assign an id to the new product.

products.addProduct(name, quantity, price);

Delete a product by id with deleteProduct(id).

products.deleteProduct(id);

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.buy(id, token);

Modify a product with updateProduct(name, quantity, price). you can modify even just one of the properties.

products.updateProduct(name, quantity, price);

Get all sales products with soldProducts() .

products.soldProducts();

Get all products bought by an user through his token soldProducts() .

products.getSalesByToken(token);

Reset original product array with reset().

products.reset();

Readme

Keywords

Package Sidebar

Install

npm i fake-e-commerce

Weekly Downloads

10

Version

1.0.10

License

MIT

Last publish

Collaborators

  • frank345