I have a function like this:
var f = function(options, successCallback, errorCallback) {
   ...
}
and I want to convert it's call to a promise. My current solution is this:
var deferred = Q.defer();
f(options,
    function (result) {
        deferred.resolve(result);
    }, function (err) {
        deferred.reject(err);
    }
);
return deferred.promise;
I can't use the Q.fcall because it expects a Node.js-style callback function(err, result) { ... }
So, is there a way to improve my code using the Q API?
 
     
    