From ecf142d1f006aaa88a0bf7ae4c1a5989bdfcd7a5 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 19 Nov 2026 16:09:22 -0800 Subject: [PATCH] [Refactor] `nvm_version`: simplify the `stable` fast path's condition An LTS filter already turns `stable` into `node`, so it never reaches this check, and the alias path needs no command substitutions. --- nvm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvm.sh b/nvm.sh index b1f0f3ef..fa1468d0 100755 --- a/nvm.sh +++ b/nvm.sh @@ -1482,7 +1482,7 @@ nvm_version() { # versions three times. With only 0.x versions installed, `stable` is the # newest even minor, so those fall through, as does an alias named `stable`, # which takes precedence. `system` is skipped, since `nvm_ls` lists it last. - if [ -z "${NVM_LTS_FILTER}" ] && [ "_${PATTERN}" = '_stable' ] && [ ! -e "$(nvm_alias_path)/stable" ]; then + if [ "_${PATTERN}" = '_stable' ] && [ ! -e "${NVM_DIR}/alias/stable" ]; then local NVM_NEWEST_INSTALLED NVM_NEWEST_INSTALLED="$(nvm_ls "${NVM_NODE_PREFIX}" | nvm_grep -e '^v' | command tail -1)" case "${NVM_NEWEST_INSTALLED}" in