SuperPromise
A promise that you can rely on!
This is basically just a promise with support for callbacks in case you want to maintain legacy support but also allow for more advanced features like await
in async functions.
Depends on bluebird.
Usage:
new SuperPromise((resolve,reject)=>{}, callback)
If callback is not undefined, it will be called and the promise will not be resolved. If callback is undefined, it will not be called and the promise will be resolved.
Example usage:
{ return { } cb;}
Calling this method with the parameters [cat.com, null]
will cause it to be resolved as a promise. Calling this method with the parameters with the parameters [cat.com, (err, res)=>{ }]
will cause the callback to be called and the promise unresolved.
Though some may find it stupid, I find this decently useful. I prefer not having to refactor 30ish files across a variety of projects just so that a personal project can support async
.