Skip to content

Commit

Permalink
refactor: simplification proposed by Jan
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeintner committed Sep 25, 2023
1 parent 72691c3 commit 73fc642
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/core/src/exposed-thing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,9 @@ export default class ExposedThing extends TD.Thing implements WoT.ExposedThing {
debug(`ExposedThing '${this.title}' calls registered readHandler for Property '${propertyName}'`);
Helpers.validateInteractionOptions(this, this.properties[propertyName], options);
const result: WoT.InteractionInput | void = await readHandler(options);
const form =
this.properties[propertyName].forms != null
? this.properties[propertyName].forms[options.formIndex]
: { contentType: "application/json" };
const form = this.properties[propertyName]?.forms[options.formIndex] ?? {
contentType: "application/json",
};

Check warning on line 404 in packages/core/src/exposed-thing.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/exposed-thing.ts#L403-L404

Added lines #L403 - L404 were not covered by tests
return ContentManager.valueToContent(
result,
this.properties[propertyName],
Expand Down

0 comments on commit 73fc642

Please sign in to comment.