Socket
Socket
Sign inDemoInstall

snore

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    snore

Simple in memory key / value store


Version published
Weekly downloads
9
Maintainers
1
Created
Weekly downloads
 

Readme

Source

snore

Simple event based in memory key / value store

Install

npm install snore

Usage

Add

const store = require("snore");

const newEntree = { message: "Hello World!" };

let entree = store.add("messages", newEntree); // {id: 1, message: "Hello World!" }
entree = store.add("messages", newEntree); // {id: 2, message: "Hello World!" }

Listen for events

let entree = store.on("update"); // {id: 2, message: "Hello World!" }

Fetch

let entree = store.fetch("messages", entree.id); // {id: 2, message: "Hello World!" }

Remove

// Set up listener on the remove event
store.on("remove", function() {
    // Do something...
});
store.remove("messages", entree.id); // the "remove" event will be called now.

Update

// Set up listener for the update event
store.on("update", function(data) {
   if(data.id === entree.id) {
       console.log(data); // {id: 2, message: "Goodbye World! }
   }
})
let entree = store.update("messages", entree.id, { message: "Goodbye World!" }); 

Keywords

FAQs

Last updated on 14 Jun 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc