Skip to content

Commit

Permalink
Merge pull request #264 from sendgrid/let-vs-var
Browse files Browse the repository at this point in the history
Backwards compatibility fix
  • Loading branch information
thinkingserious authored Aug 2, 2016
2 parents b2fac75 + 3b15777 commit e7a3f63
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/sendgrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;

0 comments on commit e7a3f63

Please sign in to comment.