Permalink
Browse files

Confirm profile object is in correct form. Fixes #16

  • Loading branch information...
1 parent 2a1cd19 commit d63fa40d79634dec63c7b53fb2b7424f6d5ae320 @dsamarin dsamarin committed Mar 26, 2013
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/irc/index.js
View
@@ -32,6 +32,15 @@ var utilities = {
**/
var Bot = module.exports = function(profile) {
+ // Confirm profile object is in correct form
+ if (!Array.isArray (profile))
+ profile = [profile];
+ for (var i = 0, len = profile.length; i < len; i++) {
+ if (!profile[i] || typeof profile[i] !== "object") {
+ throw new Error("Bot constructor: profile[" + i + "] is not an object.");
+ }
+ }
+
this.__profile = profile;
this.__listening = [];

0 comments on commit d63fa40

Please sign in to comment.