diff --git a/src/lib/features/metrics/instance/findOutdatedSdks.ts b/src/lib/features/metrics/instance/findOutdatedSdks.ts index 2f8c7cf5bdb2..edc547c04199 100644 --- a/src/lib/features/metrics/instance/findOutdatedSdks.ts +++ b/src/lib/features/metrics/instance/findOutdatedSdks.ts @@ -14,16 +14,15 @@ const config: SDKConfig = { 'unleash-client-php': '2.3.0', }; -export const isOutdatedSdk = (sdkVersion: string | null) => { - if (sdkVersion == null) return false; - const result = sdkVersion.split(':'); - if (result.length !== 2) return false; - const [sdkName, version] = result; +export const isOutdatedSdk = (sdkVersion: string | null): boolean => { + if (!sdkVersion) return false; + + const [sdkName, version] = sdkVersion.split(':'); const minVersion = config[sdkName]; - if (!minVersion) return false; - if (!semver.valid(version)) return false; - if (semver.lt(version, minVersion)) return true; - return false; + + return Boolean( + minVersion && semver.valid(version) && semver.lt(version, minVersion), + ); }; export function findOutdatedSDKs(sdkVersions: (string | null)[]): string[] {