-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added promise support to base object * updated sendingDomains for promise support * updated inboundDomains for promise support * updated messageEvents for promise support * updated recipientLists for promise support * updated relayWebhooks for promise support * updated subaccounts for promise support * updated suppressionList for promise support * updated templates for promise support * updated transmissions for promise support * updated webhooks for promise support * Replaced bluebird with native promise support for PR #154 * removed dependency for bluebird * replaced bluebird on spec tests
- Loading branch information
Showing
25 changed files
with
273 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"node" : true, | ||
"es3" : false, | ||
"esnext" : true, | ||
"strict" : true, | ||
"curly" : true, | ||
"eqeqeq" : true, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use strict'; | ||
|
||
/** | ||
* asCallback method mimics bluebird and allows | ||
* promise object to handle an optional nodeback | ||
* | ||
* @param cb {Function} | ||
* @return Promise | ||
* | ||
* @example | ||
* function eitherOr(options, callback) { | ||
* return promiseThingy(options).asCallback(callback); | ||
* } | ||
*/ | ||
Promise.prototype.asCallback = function(cb) { | ||
if (typeof cb !== 'function') { | ||
cb = noop; | ||
} | ||
|
||
return this.then((result) => { | ||
cb(null, result); | ||
return this; | ||
}).catch((err) => { | ||
cb(err); | ||
return this; | ||
}); | ||
}; | ||
|
||
function noop() {} | ||
|
||
module.exports = Promise; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.