Skip to content

Commit

Permalink
Confirm profile object is in correct form. Fixes #16
Browse files Browse the repository at this point in the history
  • Loading branch information
dsamarin committed Mar 26, 2013
1 parent 2a1cd19 commit d63fa40
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/irc/index.js
Expand Up @@ -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 = [];

Expand Down

0 comments on commit d63fa40

Please sign in to comment.