function latest(versions) {
  const len = versions.length
  if (len === 0) {
    return
  }

  let version = versions[0]
  for (let i = 1; i < len; i++) {
    if (compareVersion(version, versions[i]) <= 0) {
      version = versions[i]
    }
  }
  return version
}
Finds the largest version number lexicographically from an array of strings representing version numbers and returns it as a string.

@param {string[]} versions - The array of version numbers to compare
@returns {string|undefined} The largest version number as a string, or undefined if the array is empty
@example
latest(['1.2.3', '1.2.4', '1.3', '2.0']) // returns '2.0' because it is the largest version number.
latest(['1.2.3', '1.2.4', '1.3-alpha', '2.0-beta']) // returns '2.0-beta'. there is no special handling for pre-release versions.