/** * #see https://semver.org/ * #see https://stackoverflow.com/a/65687141/456536 */ function semverCompare(a, b) { a ||= "", b ||= "" if (a === b) return 0 if (a.startsWith(b)) return -1 if (b.startsWith(a)) return 1 return a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' }) }