Fix and refactor ext-blackfire

This commit is contained in:
Shivam Mathur
2020-02-27 17:25:54 +05:30
parent bbdc4e3b67
commit 84e88e382f
8 changed files with 105 additions and 131 deletions

View File

@ -262,13 +262,20 @@ export async function suppressOutput(os_version: string): Promise<string> {
}
}
export async function getMinorVersion(version: string): Promise<string> {
const regex = /^\d+\.\d+/;
const match = version.match(regex);
if (match === null) {
return version;
/**
* Function to get Blackfire version
*
* @param blackfire_version
*/
export async function getBlackfireVersion(
blackfire_version: null | undefined | string
): Promise<string> {
switch (blackfire_version) {
case null:
case undefined:
case '':
return '1.31.0';
default:
return blackfire_version;
}
return match[0];
}