From 6afccaa9de8471e31198c244eb5a3243cd18dd4e Mon Sep 17 00:00:00 2001 From: Wildan M Date: Sun, 26 Nov 2023 14:04:28 +0700 Subject: [PATCH] Fix sort semver --- src/util.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.js b/src/util.js index 20876b4..d910b22 100644 --- a/src/util.js +++ b/src/util.js @@ -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+'')); } /**