Skip to content

Commit

Permalink
fix(winget/version): example for latest is incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
anatawa12 committed Nov 4, 2024
1 parent aabbc38 commit 2cbd02e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions services/winget/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ function compareVersionPart(part1, part2) {
* @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 and pre-release versions are excluded.
* latest(['1.2.3', '1.2.4', '1.3', '2.0']) // returns '2.0' because pre-release versions are included but none of them are present in the array.
* latest(['1.2.3', '1.2.4', '1.3-alpha', '2.0-beta']) // returns '1.2.4' because pre-release versions are excluded and it is the largest version number among the remaining ones.
* 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.
*/
function latest(versions) {
const len = versions.length
Expand Down

0 comments on commit 2cbd02e

Please sign in to comment.