You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
401 B
JavaScript

'use strict';
const Promise = require("bluebird");
const promisifySimpleCallback = require("./");
function brokenFunction(arg, optionalArg, cb) {
cb([arg, optionalArg]);
}
let fixedFunction = promisifySimpleCallback(brokenFunction, [null, {}]);
Promise.try(() => {
return Promise.all([
fixedFunction(42),
fixedFunction(42, {foo: "bar"})
]);
}).then((results) => {
console.log(results);
});