Skip to content

Commit

Permalink
refactor: simplify data.version.model check
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeintner committed Sep 21, 2023
1 parent fecd6e4 commit 7762ea4
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions packages/td-tools/src/thing-model-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,9 @@ export class ThingModelHelpers {
* @experimental
*/
public static getModelVersion(data: ThingModel): string | undefined {
if (
"version" in data &&
data.version != null &&
typeof data.version === "object" &&
"model" in data.version &&
typeof data.version.model === "string"
) {
return data.version.model;
} else {
return undefined;
}
return typeof data?.version === "object" && typeof data?.version?.model === "string"
? data.version.model
: undefined;
}

/**
Expand Down

0 comments on commit 7762ea4

Please sign in to comment.