Comparing version 4.1.3 to 4.1.4
@@ -306,2 +306,23 @@ | ||
test('support deep wildcard without separator', function (t) { | ||
t.plan(2) | ||
const e = builder() | ||
const expected = { | ||
topic: 'hello', | ||
payload: { my: 'message' } | ||
} | ||
e.on('#', function (message, cb) { | ||
t.equal(message.topic, expected.topic) | ||
cb() | ||
}, function () { | ||
e.emit(expected, function () { | ||
e.close(function () { | ||
t.pass('closed') | ||
}) | ||
}) | ||
}) | ||
}) | ||
test('support deep wildcard - match empty words', function (t) { | ||
@@ -308,0 +329,0 @@ t.plan(2) |
@@ -1,9 +0,7 @@ | ||
/* eslint no-unused-vars: 0 */ | ||
/* eslint no-undef: 0 */ | ||
/* eslint space-infix-ops: 0 */ | ||
/// <reference types="node" /> | ||
declare function MQEmitter (options?: MQEmitterOptions): MQEmitter | ||
declare function MQEmitter(options?: MQEmitterOptions): MQEmitter | ||
export default MQEmitter | ||
interface MQEmitterOptions { | ||
@@ -17,3 +15,3 @@ concurrency?: number | ||
export type Message = object & { topic: string } | ||
export type Message = Record<string, any> & { topic: string } | ||
@@ -24,5 +22,5 @@ export interface MQEmitter { | ||
on(topic: string, listener: (message: Message, done: () => void) => void, callback?: () => void): this | ||
emit(topic: string, callback?: (error?: Error) => void): void | ||
emit(message: Message, callback?: (error?: Error) => void): void | ||
removeListener(topic: string, listener: (message: Message, done: () => void) => void, callback?: () => void): void | ||
close(callback: () => void): void | ||
} |
@@ -24,3 +24,3 @@ 'use strict' | ||
results: false, | ||
released: released | ||
released | ||
}) | ||
@@ -27,0 +27,0 @@ |
{ | ||
"name": "mqemitter", | ||
"version": "4.1.3", | ||
"version": "4.1.4", | ||
"description": "An Opinionated Message Queue with an emitter-style API", | ||
@@ -5,0 +5,0 @@ "main": "mqemitter.js", |
@@ -61,3 +61,3 @@ <!-- markdownlint-disable MD013 MD024 --> | ||
- options `<object>` | ||
- `concurrency` `<boolean>` maximum number of concurrent messages that can be on concurrent delivery. __Default__: `0` | ||
- `concurrency` `<number>` maximum number of concurrent messages that can be on concurrent delivery. __Default__: `0` | ||
- `wildcardOne` `<string>` a char to use for matching exactly one _non-empty_ level word. __Default__: `+` | ||
@@ -119,3 +119,3 @@ - `wildcardSome` `<string>` a char to use for matching multiple level wildcards. __Default__: #` | ||
cb() | ||
} | ||
}) | ||
emitter.on('hello/+', function(message, cb) { | ||
@@ -122,0 +122,0 @@ // will not be called |
@@ -8,3 +8,3 @@ 'use strict' | ||
builder: mq, | ||
test: test | ||
test | ||
}) | ||
@@ -11,0 +11,0 @@ |
/* eslint no-unused-vars: 0 */ | ||
/* eslint no-undef: 0 */ | ||
import { MQEmitter, Message } from '../../mqemitter' | ||
import MQEmitter, { Message } from '../../mqemitter' | ||
@@ -38,5 +38,5 @@ const noop = function () {} | ||
mq.emit('hello/world') | ||
mq.emit({ topic: 'hello/world', payload: 'or any other fields', [Symbol.for('me')]: 42 }) | ||
mq.emit('hello/world', function (err) { | ||
mq.emit({ topic: 'hello/world' }, function (err) { | ||
console.log(err) | ||
@@ -43,0 +43,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33953
15
755