Skip to content

Commit

Permalink
Remove duplicate code in nvm_npm_global_modules()
Browse files Browse the repository at this point in the history
No matter what's the result of the condition here, the path is the same.
  • Loading branch information
PeterDaveHello committed Feb 22, 2018
1 parent f290ccf commit bb80349
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions nvm.sh
Expand Up @@ -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)
Expand Down

0 comments on commit bb80349

Please sign in to comment.