🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

mqemitter

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mqemitter - npm Package Compare versions

Comparing version

to
0.1.1

..travis.yml.un~

9

index.js

@@ -56,3 +56,2 @@ /*

assert(message)
assert(cb)

@@ -93,2 +92,6 @@ if (this.concurrency > 0 && this.current >= this.concurrency) {

if (matches.length === 0) {
return this._next(receiver)
}
receiver.num = matches.length

@@ -121,3 +124,5 @@ receiver.callback = callback

if (that.num === 0) {
that.callback()
if (that.callback) {
that.callback()
}
mq._next(that)

@@ -124,0 +129,0 @@ }

{
"name": "mqemitter",
"version": "0.1.0",
"version": "0.1.1",
"description": "An Opinionated Message Queue with an emitter-style API",

@@ -10,3 +10,21 @@ "main": "index.js",

"pre-commit": ["test"],
"author": "",
"website": "https://github.com/mcollina/mqemitter",
"repository": {
"type": "git",
"url": "https://github.com/mcollina/mqemitter.git"
},
"bugs": {
"url": "http://github.com/mcollina/mqemitter/issues"
},
"author": "Matteo Collina <hello@matteocollina.com>",
"keywords": [
"emitter",
"events",
"message queue",
"mq",
"publish",
"subscribe",
"pub",
"sub"
],
"license": "ISC",

@@ -13,0 +31,0 @@ "devDependencies": {

@@ -6,3 +6,3 @@

test('support on and emit', function(t) {
t.plan(1)
t.plan(2)

@@ -16,2 +16,3 @@ var e = mq()

e.on('hello world', function(message, cb) {
t.equal(e.current, 1, 'number of current messages')
t.equal(message, expected)

@@ -89,3 +90,3 @@ cb()

test('queue concurrency', function(t) {
t.plan(2)
t.plan(3)

@@ -101,2 +102,4 @@ var e = mq({ concurrency: 1 })

t.equal(e.concurrency, 1)
e.on('hello 1', function(message, cb) {

@@ -171,1 +174,28 @@ setTimeout(cb, 5)

})
test('without a callback on emit', function(t) {
var e = mq()
, expected = {
topic: 'hello world'
, payload: { my: 'message' }
}
e.on('hello world', function(message, cb) {
cb()
t.end()
})
e.emit(expected)
})
test('without any listeners', function(t) {
var e = mq()
, expected = {
topic: 'hello world'
, payload: { my: 'message' }
}
e.emit(expected)
t.equal(e.current, 0, 'reset the current messages trackers')
t.end()
})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet