store-memory
Simplified memory store.
Install
$ npm install store-memory
Usage
// Create a new store.const store = const memoryStore = const productStore = ; // Add a new product to the store.const product = name: "mug"const id = productStore; // Find all products in the store.const products = productStore; // Find a product by id.const product = productStore; // Remove all products.productStore; // Remove a product by id.productStore; // Update a product.productStore; // Count the products.productStore; // Handle a product that does not exist.try productStore; productStore; productStore; catche if e instanceof memoryStoreNotFoundError // Do something. // Handle an invalid id.try productStore; productStore; productStore; catche if e instanceof ReferenceError // Do something. // Handle invalid data.try productStore; productStore; catche if e instanceof ReferenceError // Do something.
License
MIT