[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.
This commit is contained in:
Jordan Harband committed 2026-11-19 16:09:39 -08:00
1 parent b0a377a524
commit ecf142d1f0
1 file changed
+1 -1
+1 -1
View File
@@ -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