fakeproductpackage
v0.0.3
Published
a simple package to manage a fake products array
Downloads
13
Maintainers
Readme
fakeProductsPackage
create your fake products
Installation
npm i fakeProductsPackage
Usage
For use the fake Products
var fakeproducts = require('fakeProductsPackage');
console.log('products', fakeproducts.all()); // outputs all products
fakeproducts.getByCode(1); // return product with code number 1
console.log('products', fakeproducts.add(
{name: "mele verdi", price: 0.6, amount: 27})); // add new product
fakeproducts.delete(1); // delete products with code number 1
console.log('products', fakeproducts.update(2,
{name: "pesca", price: 0.70, amount: 50})); // modify product with code number 2
fakeproducts.buy(3,'pippo');// User 'pippo' buy a product number 3 using a token('pippo'): the quantity decreases and sales increase;
fakeproducts.reset(); // reset fake products array;