I'm using a library providing a class whose constructor makes use of the Node.js callback pattern:
new FooBar({key: value}, function(err, data) {
console.log(data);
});
I want to use a promise instead so that I can do something like this:
fooBarWrapper({key: value}).then(function(data) {
console.log(data);
});
I know I can create a wrapper with Q.denodeify
or call a function with Q.nfcall
, but how does it work for constructors?