From 9c5d5d7ced6f2d36cb214ccffa4e7d87dec7be2a Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 6 Jan 2022 16:27:20 -0800 Subject: [PATCH] [arborist] [refactor] `build-ideal-tree`: remove unnecessary Promise stuff --- workspaces/arborist/lib/arborist/build-ideal-tree.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/workspaces/arborist/lib/arborist/build-ideal-tree.js b/workspaces/arborist/lib/arborist/build-ideal-tree.js index 899d92ca937cc..8c8cb3efa3088 100644 --- a/workspaces/arborist/lib/arborist/build-ideal-tree.js +++ b/workspaces/arborist/lib/arborist/build-ideal-tree.js @@ -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. @@ -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