Skip to content

Commit

Permalink
[arborist] [refactor] build-ideal-tree: remove unnecessary Promise …
Browse files Browse the repository at this point in the history
…stuff
  • Loading branch information
ljharb committed Jan 7, 2022
1 parent 3b93654 commit 9c5d5d7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions workspaces/arborist/lib/arborist/build-ideal-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
// public method
async buildIdealTree (options = {}) {
if (this.idealTree) {
return Promise.resolve(this.idealTree)
return this.idealTree
}

// allow the user to set reify options on the ctor as well.
Expand All @@ -194,8 +194,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
process.emit('time', 'idealTree')

if (!options.add && !options.rm && !options.update && this[_global]) {
const er = new Error('global requires add, rm, or update option')
return Promise.reject(er)
throw new Error('global requires add, rm, or update option')
}

// first get the virtual tree, if possible. If there's a lockfile, then
Expand Down

0 comments on commit 9c5d5d7

Please sign in to comment.