Repository: nvm-sh/nvm
File: nvm.sh (Shell)

Code before:

nvm_install_default_packages() {
  nvm_echo "Installing default global packages from ${NVM_DIR}/default-packages..."
  nvm_echo "npm install -g --quiet $1"

  if ! nvm_echo "$1" | command xargs npm install -g --quiet; then
    nvm_err "Failed installing default packages. Please check if your default-packages file or a package in it has problems!"
    return 1
  fi
}

nvm_supports_source_options() {
  # shellcheck disable=SC1091,SC2240
    [ "_$( . /dev/stdin yes 2> /dev/null <<'EOF'
[ $# -gt 0 ] && nvm_echo $1
EOF
  )" = "_yes" ]
}

nvm_supports_xz() {
  if [ -z "${1-}" ]; then
    return 1
  fi

  # macOS 10.9.0 and later support extracting xz with tar
  if [ "$(nvm_get_os)" = "darwin" ]; then
    MACOS_VERSION="$(sw_vers -productVersion)"
    if nvm_version_greater "10.9.0" "${MACOS_VERSION}"; then
      return 1
    fi
  # Conservatively assume other operating systems require an xz executable on the PATH
  elif ! command which xz >/dev/null 2>&1; then
    return 1
  fi

  # all node versions v4.0.0 and later have xz
  if nvm_is_merged_node_version "${1}"; then
    return 0
  fi

  # 0.12x: node v0.12.10 and later have xz
  if nvm_version_greater_than_or_equal_to "${1}" "0.12.10" && nvm_version_greater "0.13.0" "${1}"; then
    return 0
  fi

  # 0.10x: node v0.10.42 and later have xz
  if nvm_version_greater_than_or_equal_to "${1}" "0.10.42" && nvm_version_greater "0.11.0" "${1}"; then
    return 0
  fi

  local NVM_OS

Review comment (suggestion):
```suggestion
  if [ "$(nvm_get_os)" = 'darwin' ]; then
```

Code after:
        nvm_iojs_prefix nvm_node_prefix \
        nvm_add_iojs_prefix nvm_strip_iojs_prefix \
        nvm_is_iojs_version nvm_is_alias nvm_has_non_aliased \
        nvm_ls_remote nvm_ls_remote_iojs nvm_ls_remote_index_tab \
        nvm_ls nvm_remote_version nvm_remote_versions \
        nvm_install_binary nvm_install_source nvm_clang_version \
        nvm_get_mirror nvm_get_download_slug nvm_download_artifact \
        nvm_install_npm_if_needed nvm_use_if_needed nvm_check_file_permissions \
        nvm_print_versions nvm_compute_checksum nvm_checksum \
        nvm_get_checksum_alg nvm_get_checksum nvm_compare_checksum \
        nvm_version nvm_rc_version nvm_match_version \
        nvm_ensure_default_set nvm_get_arch nvm_get_os \
        nvm_print_implicit_alias nvm_validate_implicit_alias \
        nvm_resolve_alias nvm_ls_current nvm_alias \
        nvm_binary_available nvm_change_path nvm_strip_path \
        nvm_num_version_groups nvm_format_version nvm_ensure_version_prefix \
        nvm_normalize_version nvm_is_valid_version \
        nvm_ensure_version_installed nvm_cache_dir \
        nvm_version_path nvm_alias_path nvm_version_dir \
        nvm_find_nvmrc nvm_find_up nvm_tree_contains_path \
        nvm_version_greater nvm_version_greater_than_or_equal_to \
        nvm_print_npm_version nvm_install_latest_npm nvm_npm_global_modules \
        nvm_has_system_node nvm_has_system_iojs \
        nvm_download nvm_get_latest nvm_has nvm_install_default_packages nvm_get_default_packages \
        nvm_curl_use_compression nvm_curl_version \
        nvm_supports_source_options nvm_auto nvm_supports_xz \
        nvm_echo nvm_err nvm_grep nvm_cd \
        nvm_die_on_prefix nvm_get_make_jobs nvm_get_minor_version \
        nvm_has_solaris_binary nvm_is_merged_node_version \
        nvm_is_natural_num nvm_is_version_installed \
        nvm_list_aliases nvm_make_alias nvm_print_alias_path \
        nvm_print_default_alias nvm_print_formatted_alias nvm_resolve_local_alias \
        nvm_sanitize_path nvm_has_colors nvm_process_parameters \
        nvm_node_version_has_solaris_binary nvm_iojs_version_has_solaris_binary \
        nvm_curl_libz_support nvm_command_info nvm_is_zsh nvm_stdout_is_terminal \
        >/dev/null 2>&1
      unset NVM_RC_VERSION NVM_NODEJS_ORG_MIRROR NVM_IOJS_ORG_MIRROR NVM_DIR \
        NVM_CD_FLAGS NVM_BIN NVM_INC NVM_MAKE_JOBS \
        >/dev/null 2>&1
    ;;
    *)
      >&2 nvm --help
      return 127
    ;;
  esac
}

nvm_get_default_packages() {
  local NVM_DEFAULT_PACKAGE_FILE="${NVM_DIR}/default-packages"
  if [ -f "${NVM_DEFAULT_PACKAGE_FILE}" ]; then
    local DEFAULT_PACKAGES