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

mqemitter

Package Overview
Dependencies
Maintainers
1
Versions
32
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 4.5.0 to 5.0.0

14

mqemitter.js

@@ -77,4 +77,16 @@ 'use strict'

assert(notify)
this._matcher.remove(topic, notify)
const that = this
setImmediate(function () {
that._matcher.remove(topic, notify)
if (done) {
done()
}
})
return this
}
MQEmitter.prototype.removeAllListeners = function removeListener (topic, done) {
assert(topic)
this._matcher.remove(topic)
if (done) {

@@ -81,0 +93,0 @@ setImmediate(done)

12

package.json
{
"name": "mqemitter",
"version": "4.5.0",
"version": "5.0.0",
"description": "An Opinionated Message Queue with an emitter-style API",

@@ -48,4 +48,4 @@ "main": "mqemitter.js",

"@types/node": "^16.11.1",
"@typescript-eslint/eslint-plugin": "^2.19.2",
"@typescript-eslint/parser": "^2.19.2",
"@typescript-eslint/eslint-plugin": "^5.25.0",
"@typescript-eslint/parser": "^5.25.0",
"markdownlint-cli": "^0.29.0",

@@ -55,5 +55,5 @@ "nyc": "^15.0.0",

"snazzy": "^9.0.0",
"standard": "^16.0.0",
"standard": "^17.0.0",
"tape": "^5.0.1",
"tsd": "^0.18.0",
"tsd": "^0.20.0",
"typescript": "^4.0.2"

@@ -63,4 +63,4 @@ },

"fastparallel": "^2.3.0",
"qlobber": "^5.0.0"
"qlobber": "^7.0.0"
}
}

@@ -118,2 +118,26 @@ 'use strict'

test('removeAllListeners removes listeners', function (t) {
const e = mq()
e.on('hello', function () {
t.fail('listener called')
})
e.removeAllListeners('hello', function () {
e.emit({ topic: 'hello' }, function () {
t.end()
})
})
})
test('removeAllListeners without a callback does not throw', function (t) {
const e = mq()
function fn () {}
e.on('hello', fn)
e.removeAllListeners('hello')
t.end()
})
test('set defaults to opts', function (t) {

@@ -132,1 +156,27 @@ const opts = {}

})
test('removeListener inside messageHandler', function (t) {
t.plan(3)
const e = mq()
function messageHandler1 (message, cb) {
t.ok(true, 'messageHandler1 called')
// removes itself
e.removeListener('hello', messageHandler1)
cb()
}
e.on('hello', messageHandler1)
function messageHandler2 (message, cb) {
t.ok(true, 'messageHandler2 called')
cb()
}
e.on('hello', messageHandler2)
e.emit({ topic: 'hello' }, function () {
t.ok(true, 'emit callback received')
})
})
/// <reference types="node" />
declare function MQEmitter(options?: MQEmitterOptions): MQEmitter
export default MQEmitter
interface MQEmitterOptions {

@@ -25,1 +21,3 @@ concurrency?: number

}
export default function (options?: MQEmitterOptions): MQEmitter

Sorry, the diff of this file is not supported yet

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