I'm using Bluebird as a promise library and I have the following callback pattern that I would like to use promises for.
var func = function(err, data) {
if(err) { // do this with err }
else { // do this with data }
}
Desired calling pattern:
func.resolve(data);
func.reject(err);
How would I modify the original function definition to support the desired calling pattern?