Skip to content

Commit 9c5d5d7

Browse files
committed
[arborist] [refactor] build-ideal-tree: remove unnecessary Promise stuff
1 parent 3b93654 commit 9c5d5d7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

workspaces/arborist/lib/arborist/build-ideal-tree.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
176176
// public method
177177
async buildIdealTree (options = {}) {
178178
if (this.idealTree) {
179-
return Promise.resolve(this.idealTree)
179+
return this.idealTree
180180
}
181181

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

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

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

0 commit comments

Comments
 (0)