Skip to content
This repository has been archived by the owner on Aug 21, 2019. It is now read-only.

Commit

Permalink
Fix error checking for recipient array
Browse files Browse the repository at this point in the history
`typeof recipients` will return `'object'` when recipients is an array. Changed to use `instanceof`.
  • Loading branch information
hurricane766 committed May 19, 2015
1 parent 7de675b commit c55eee6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mailgun.js
Expand Up @@ -94,7 +94,7 @@ Mailgun.prototype.sendText = function(sender, recipients, subject, text) {
if (typeof recipients === 'undefined')
throw new Error('recipients is undefined');

if (typeof recipients !== 'string' && typeof recipients !== 'array')
if (typeof recipients !== 'string' && !(recipients instanceof Array))
throw new Error('recipients is not a string or an array');

// Less than 4 arguments means we're missing something that prevents
Expand Down Expand Up @@ -161,7 +161,7 @@ Mailgun.prototype.sendRaw = function(sender, recipients, rawBody) {
if (typeof recipients === 'undefined')
throw new Error('recipients is undefined');

if (typeof recipients !== 'string' && typeof recipients !== 'array')
if (typeof recipients !== 'string' && !(recipients instanceof Array))
throw new Error('recipients is not a string or an array');

// Less than 3 arguments means we're missing something that prevents
Expand Down

0 comments on commit c55eee6

Please sign in to comment.