diff options
-rw-r--r-- | lib/sendgrid.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sendgrid.js b/lib/sendgrid.js index 4150935..eb58f84 100644 --- a/lib/sendgrid.js +++ b/lib/sendgrid.js @@ -26,7 +26,7 @@ function isValidResponse(response) { * Helper to get a new empty request */ function getEmptyRequest(data) { - let request = JSON.parse(JSON.stringify(emptyRequest)); + var request = JSON.parse(JSON.stringify(emptyRequest)); if (data && typeof data === 'object') { for (var key in data) { if (data.hasOwnProperty(key)) { @@ -115,7 +115,12 @@ function SendGrid(apiKey, host, globalHeaders) { } //Try to use native promises by default -SendGrid.Promise = Promise || null; +if (typeof Promise !== 'undefined') { + SendGrid.Promise = Promise; +} +else { + SendGrid.Promise = null; +} //Export module.exports = SendGrid; |