Skip to content

Commit

Permalink
Fix sort semver
Browse files Browse the repository at this point in the history
  • Loading branch information
willnode committed Nov 26, 2023
1 parent bfac868 commit 6afccaa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,8 @@ export function splitLimit(/** @type {string} */ input,/** @type {string|RegExp}
* @param {string[]} arr
*/
export function sortSemver(arr) {
return arr.map(a => a.split('.').map(n => +n + 100000).join('.')).sort()
.map(a => a.split('.').map(n => +n - 100000).join('.'));
return arr.map(a => a.replace(/\d+/g, n => +n+100000+'')).sort()
.map(a => a.replace(/\d+/g, n => +n-100000+''));
}

/**
Expand Down

0 comments on commit 6afccaa

Please sign in to comment.