From bb803492d86b5df4d5b6dd4af70352f5366ac54a Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Mon, 5 Feb 2018 06:21:33 +0800 Subject: [PATCH] Remove duplicate code in nvm_npm_global_modules() No matter what's the result of the condition here, the path is the same. --- nvm.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/nvm.sh b/nvm.sh index 412e6eb..d5e003f 100644 --- a/nvm.sh +++ b/nvm.sh @@ -2077,11 +2077,7 @@ nvm_npm_global_modules() { local NPMLIST local VERSION VERSION="$1" - if [ "_$VERSION" = "_system" ]; then - NPMLIST=$(nvm use system > /dev/null && npm list -g --depth=0 2> /dev/null | command sed 1,1d) - else - NPMLIST=$(nvm use "$VERSION" > /dev/null && npm list -g --depth=0 2> /dev/null | command sed 1,1d) - fi + NPMLIST=$(nvm use "$VERSION" > /dev/null && npm list -g --depth=0 2> /dev/null | command sed 1,1d) local INSTALLS INSTALLS=$(nvm_echo "$NPMLIST" | command sed -e '/ -> / d' -e '/\(empty\)/ d' -e 's/^.* \(.*@[^ ]*\).*/\1/' -e '/^npm@[^ ]*.*$/ d' | command xargs)