New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

level-trigger

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

level-trigger - npm Package Compare versions

Comparing version 1.0.4 to 1.1.0

test/start.js

15

index.js

@@ -50,3 +50,3 @@ var shasum = require('shasum')

input.pre(function (ch, add) {
function doHook (ch, add) {
var key = map(ch)

@@ -58,4 +58,15 @@ var hash = shasum(key)

pending[hash] = (0 || pending[hash]) + 1
})
}
input.pre(doHook)
//process the whole db as a batch
jobs.start = function () {
input.createReadStream()
.on('data', function (data) {
doHook(data, doJob)
})
return jobs
}
jobs.createReadStream().on('data', doJob)

@@ -62,0 +73,0 @@ jobs.post(doJob)

9

package.json
{
"name": "level-trigger",
"version": "1.0.4",
"version": "1.1.0",
"homepage": "https://github.com/dominictarr/level-trigger",

@@ -14,6 +14,6 @@ "repository": {

"macgyver": "~1.10.1",
"rimraf": "~2.1.4",
"rimraf": "~2.0.2",
"level-sublevel": "~3.1",
"levelup": "~0.6",
"rimraf": "~2.0.2"
"tape": "~0.2.2"
},

@@ -24,3 +24,4 @@ "scripts": {

"author": "'Dominic Tarr' <dominic.tarr@gmail.com> (http://dominictarr.com)",
"license": "MIT"
"license": "MIT",
"stability": "unstable"
}

@@ -11,18 +11,20 @@ # level-trigger

## Stability
Unstable: Expect patches and features, possible api changes.
# Example
``` js
var trigger = require('level-trigger')
trigger(db)
var db = require('levelup')('/tmp/level-trigger-example')
var SubLevel = require('level-sublevel'); SubLevel(db) //MUST install sublevel.
var Trigger = require('level-trigger')
db.trigger.add({
name: 'example',
start: 'A', end: '~',
mapKey: function (key) {
var trigDb = Trigger(db, 'example', function (ch) {
//optionally index the job with a different key.
//if there are two jobs with the same key,
//it will only be triggered once.
return key
return ch.key
},
job: function (value, done) {
function (value, done) {
//call done when job is done.

@@ -33,2 +35,10 @@ done()

//if you want, start the trigger in batch mode.
//this will process all the keys in the input db.
//otherwise, jobs will be processed whenever a key is inserted!
if(require('optimist').argv.batch)
trigDb.start()
```

@@ -35,0 +45,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc