mirror of
https://github.com/Hopiu/postal.js.git
synced 2026-03-16 22:20:23 +00:00
Added check for valid constructor args to SubscriptionDefinition as well as a check on topic.length. Fixes #48
This commit is contained in:
parent
40897fac57
commit
d25b1d0f48
3 changed files with 13 additions and 1 deletions
|
|
@ -81,6 +81,12 @@
|
|||
/* global postal */
|
||||
/*jshint -W117 */
|
||||
var SubscriptionDefinition = function ( channel, topic, callback ) {
|
||||
if(arguments.length !== 3) {
|
||||
throw new Error("You must provide a channel, topic and callback when creating a SubscriptionDefinition instance.");
|
||||
}
|
||||
if(topic.length === 0) {
|
||||
throw new Error("Topics cannot be empty");
|
||||
}
|
||||
this.channel = channel;
|
||||
this.topic = topic;
|
||||
this.callback = callback;
|
||||
|
|
|
|||
2
lib/postal.min.js
vendored
2
lib/postal.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,12 @@
|
|||
/* global postal */
|
||||
/*jshint -W117 */
|
||||
var SubscriptionDefinition = function ( channel, topic, callback ) {
|
||||
if(arguments.length !== 3) {
|
||||
throw new Error("You must provide a channel, topic and callback when creating a SubscriptionDefinition instance.");
|
||||
}
|
||||
if(topic.length === 0) {
|
||||
throw new Error("Topics cannot be empty");
|
||||
}
|
||||
this.channel = channel;
|
||||
this.topic = topic;
|
||||
this.callback = callback;
|
||||
|
|
|
|||
Loading…
Reference in a new issue