Skip to content

Commit

Permalink
Remove promise nesting when no callback
Browse files Browse the repository at this point in the history
  • Loading branch information
kb2ma committed Sep 19, 2022
1 parent ad170f5 commit f0a5338
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/docker.js
Expand Up @@ -283,12 +283,8 @@ Docker.prototype.buildImage = function(file, opts, callback) {
}

if (callback === undefined) {
const prepareCtxPromise = new self.modem.Promise(function(resolve, _) {
util.prepareBuildContext(file, resolve)
});

return prepareCtxPromise.then((ctx)=> {
return new self.modem.Promise(function(resolve, reject) {
return new self.modem.Promise(function(resolve, reject) {
util.prepareBuildContext(file, (ctx) => {
optsf.file = ctx;
self.modem.dial(optsf, function(err, data) {
if (err) {
Expand All @@ -297,7 +293,7 @@ Docker.prototype.buildImage = function(file, opts, callback) {
resolve(data);
});
});
})
});
} else {
util.prepareBuildContext(file, (ctx) => {
optsf.file = ctx;
Expand Down

0 comments on commit f0a5338

Please sign in to comment.