File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,12 +136,23 @@ function comparePrereleasePrecedence(a: string, b: string): number {
136136 return 0
137137}
138138
139+ function parseSemver ( v : string ) {
140+ const hyphen = v . indexOf ( '-' )
141+ const core = hyphen === - 1 ? v : v . slice ( 0 , hyphen )
142+ const pre = hyphen === - 1 ? undefined : v . slice ( hyphen + 1 )
143+
144+ return {
145+ core,
146+ pre,
147+ }
148+ }
149+
139150export function lt ( a : string , b : string ) : boolean {
140151 a = stripBuildMetadata ( a )
141152 b = stripBuildMetadata ( b )
142153
143- const [ coreA , preA ] = a . split ( '-' )
144- const [ coreB , preB ] = b . split ( '-' )
154+ const { core : coreA , pre : preA } = parseSemver ( a )
155+ const { core : coreB , pre : preB } = parseSemver ( b )
145156
146157 const partsA = parseCoreVersion ( coreA ) !
147158 const partsB = parseCoreVersion ( coreB ) !
You can’t perform that action at this time.
0 commit comments