Skip to content

Commit

Permalink
fix: add proper boolean check
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeintner committed Sep 20, 2023
1 parent e4c6590 commit 9954040
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/td-tools/src/thing-model-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ export class ThingModelHelpers {

for (const key in submodelObj) {
const sub = submodelObj[key];
if (options.selfComposition != null) {
if (options.selfComposition === true) {
if (!data.links) {
throw new Error(
"You used self composition but links are missing; they are needed to extract the instance name"
Expand Down Expand Up @@ -449,7 +449,7 @@ export class ThingModelHelpers {
}
}
}
if (!data.links || options.selfComposition != null) {
if (!data.links || options.selfComposition === true) {
data.links = [];
}
// add reference to the thing model
Expand Down Expand Up @@ -508,7 +508,7 @@ export class ThingModelHelpers {
extendedModel.properties = {};
}
for (const key in properties) {
if (dest.properties != null && dest.properties[key] != null) {
if (dest.properties && dest.properties[key] != null) {
extendedModel.properties[key] = { ...properties[key], ...dest.properties[key] };
} else {
extendedModel.properties[key] = properties[key];
Expand Down

0 comments on commit 9954040

Please sign in to comment.