1- import TimeoutError from '../errors/TimeoutError' ;
1+ import TimeoutError from '../../../ errors/TimeoutError' ;
22
33interface IndexOfAble {
44 indexOf ( match :string ) : number ;
@@ -119,15 +119,12 @@ export class Utils {
119119 }
120120
121121 /**
122- * Checks if a version is number is greater than or equal (AKA at least) to a specific compare
123- * to version.
124- * Limited to only checking for major and minor version values, patch versions are ignored
125- * @param toCheck - Version we want to check
126- * @param compareTo - Version we want to be at or higher
127- * @returns {string } - Returns true if toCheck >= compareTo
122+ * Returns trimmed version number
123+ * e.g: "10.01.30" becomes "10.01"
124+ * @param version - version number we want to check
128125 */
129- public static isVersionAtLeast ( toCheck : string | number , compareTo : number ) : boolean {
130- const osVersionParts = toCheck . toString ( ) . split ( "." ) ;
126+ public static parseVersionString ( version : string | number ) : number {
127+ const osVersionParts = version . toString ( ) . split ( "." ) ;
131128 const majorVersion = Utils . padStart ( osVersionParts [ 0 ] , 2 , "0" ) ;
132129 let minorVersion : string ;
133130 if ( osVersionParts [ 1 ] ) {
@@ -137,8 +134,19 @@ export class Utils {
137134 minorVersion = "00" ;
138135 }
139136
140- const majorAndMinor = Number ( `${ majorVersion } .${ minorVersion } ` ) ;
141- return majorAndMinor >= compareTo ;
137+ return Number ( `${ majorVersion } .${ minorVersion } ` ) ;
138+ }
139+
140+ /**
141+ * Checks if a version is number is greater than or equal (AKA at least) to a specific compare
142+ * to version.
143+ * Limited to only checking for major and minor version values, patch versions are ignored
144+ * @param toCheck - Version we want to check
145+ * @param compareTo - Version we want to be at or higher
146+ * @returns {string } - Returns true if toCheck >= compareTo
147+ */
148+ public static isVersionAtLeast ( toCheck : string | number , compareTo : number ) : boolean {
149+ return this . parseVersionString ( toCheck ) >= compareTo ;
142150 }
143151
144152 public static enforceAppId ( appId : string | undefined | null ) : void {
0 commit comments