function compareAPIVersions (ver1, ver2) {
	if (ver1 && !ver2) return 1;
	else if (!ver1 && ver2) return -1;
	else if (!ver1 && !ver2) return 0;
	const verRegex = /([a-z]+)([0-9]+)([a-z]+)?([0-9]+)?/;
	const ver1Extraction = verRegex.exec(ver1);
	const ver2Extraction = verRegex.exec(ver2);

	const ver1Major = ver1Extraction[2];
	const ver1MinorStr = ver1Extraction[3];
	const ver1Minor = ver1Extraction[4];
	const ver2Major = ver2Extraction[2];
	const ver2MinorStr = ver2Extraction[3];
	const ver2Minor = ver2Extraction[4];

	if (ver1Major > ver2Major) return 1;
	else if (ver1Major < ver2Major) return -1;

	if (ver1MinorStr === 'beta' && ver2MinorStr === 'alpha') return 1;
	else if (ver1MinorStr === 'alpha' && ver2MinorStr === 'beta') return -1;
	else if (ver1MinorStr && !ver2MinorStr) return -1;
	else if (!ver1MinorStr && ver2MinorStr) return 1;

	if (ver1Minor > ver2Minor) return 1;
	else if (ver1Minor < ver2Minor) return -1;

	return 0;
}
/**
 * Classic compare function but takes Kubernetes API version, e.g. v1beta1 and v1alpha2.
 *
 * @param {String} ver1 Kubernetes version to compare to
 * @param {String} ver2 Kubernetes version to compare with
 * @returns < 0 if ver1 is a lower version than ver2, === 0 if ver1 is equal to ver2,
 *          and > 0 if ver 1 is a greater version than ver2
 */
Classic compare function but takes Kubernetes API version, e.g. v1beta1 and v1alpha2.
@param {String} ver1 Kubernetes version to compare to
@param {String} ver2 Kubernetes version to compare with
@returns < 0 if ver1 is a lower version than ver2, === 0 if ver1 is equal to ver2,
and > 0 if ver 1 is a greater version than ver2
Classic compare function but takes Kubernetes API version e . g . v1beta1 and v1alpha2 . @param { String } ver1 Kubernetes version to compare to @param { String } ver2 Kubernetes version to compare with @returns < 0 if ver1 is a lower version than ver2 === 0 if ver1 is equal to ver2 and > 0 if ver 1 is a greater version than ver2
function compareAPIVersions (ver1, ver2) {
	if (ver1 && !ver2) return 1;
	else if (!ver1 && ver2) return -1;
	else if (!ver1 && !ver2) return 0;
	const verRegex = /([a-z]+)([0-9]+)([a-z]+)?([0-9]+)?/;
	const ver1Extraction = verRegex.exec(ver1);
	const ver2Extraction = verRegex.exec(ver2);
	const ver1Major = ver1Extraction[2];
	const ver1MinorStr = ver1Extraction[3];
	const ver1Minor = ver1Extraction[4];
	const ver2Major = ver2Extraction[2];
	const ver2MinorStr = ver2Extraction[3];
	const ver2Minor = ver2Extraction[4];
	if (ver1Major > ver2Major) return 1;
	else if (ver1Major < ver2Major) return -1;
	if (ver1MinorStr === 'beta' && ver2MinorStr === 'alpha') return 1;
	else if (ver1MinorStr === 'alpha' && ver2MinorStr === 'beta') return -1;
	else if (ver1MinorStr && !ver2MinorStr) return -1;
	else if (!ver1MinorStr && ver2MinorStr) return 1;
	if (ver1Minor > ver2Minor) return 1;
	else if (ver1Minor < ver2Minor) return -1;
	return 0;
}
function compareAPIVersions ( ver1 , ver2 ) { if ( ver1 && ! ver2 ) return 1 ; else if ( ! ver1 && ver2 ) return - 1 ; else if ( ! ver1 && ! ver2 ) return 0 ; const verRegex = / ([a-z]+)([0-9]+)([a-z]+)?([0-9]+)? / ; const ver1Extraction = verRegex . exec ( ver1 ) ; const ver2Extraction = verRegex . exec ( ver2 ) ; const ver1Major = ver1Extraction [ 2 ] ; const ver1MinorStr = ver1Extraction [ 3 ] ; const ver1Minor = ver1Extraction [ 4 ] ; const ver2Major = ver2Extraction [ 2 ] ; const ver2MinorStr = ver2Extraction [ 3 ] ; const ver2Minor = ver2Extraction [ 4 ] ; if ( ver1Major > ver2Major ) return 1 ; else if ( ver1Major < ver2Major ) return - 1 ; if ( ver1MinorStr === 'beta' && ver2MinorStr === 'alpha' ) return 1 ; else if ( ver1MinorStr === 'alpha' && ver2MinorStr === 'beta' ) return - 1 ; else if ( ver1MinorStr && ! ver2MinorStr ) return - 1 ; else if ( ! ver1MinorStr && ver2MinorStr ) return 1 ; if ( ver1Minor > ver2Minor ) return 1 ; else if ( ver1Minor < ver2Minor ) return - 1 ; return 0 ; }
Classic compare function but takes Kubernetes API version, e.g.
Classic compare function but takes Kubernetes API version e . g .