Skip to content

Commit

Permalink
refactor: revert changes in package "examples"
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeintner committed Sep 20, 2023
1 parent 4204a90 commit 100bdde
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/examples/src/scripts/countdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ WoT.produce({
"startCountdown",
async (params: WoT.InteractionOutput, options): Promise<WoT.InteractionInput> => {
let initValue = 100;
if (params !== undefined) {
if (params) {
const value = await params.value();
if (typeof value === "number") {
initValue = value as number;
Expand All @@ -147,7 +147,7 @@ WoT.produce({
thing.setActionHandler(
"stopCountdown",
async (params: WoT.InteractionOutput, options): Promise<WoT.InteractionInput> => {
if (params !== undefined) {
if (params) {
const value = await params.value();
if (typeof value === "string" && countdowns.has(value)) {
const as = countdowns.get(value);
Expand All @@ -170,7 +170,7 @@ WoT.produce({
thing.setActionHandler(
"monitorCountdown",
async (params: WoT.InteractionOutput, options): Promise<WoT.InteractionInput> => {
if (params !== undefined) {
if (params) {
const value = await params.value();
if (typeof value === "string" && countdowns.has(value)) {
const as = countdowns.get(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ WoTHelpers.fetch("http://127.0.0.1:8080/smart-coffee-machine").then(async (td) =
uriVariables: { drinkId: "latte", size: "l", quantity: 3 },
});
const makeCoffeep = (await makeCoffee?.value()) as Record<string, unknown>;
if (makeCoffeep.result !== undefined) {
if (makeCoffeep.result) {
log("Enjoy your drink!", makeCoffeep);
} else {
log("Failed making your drink:", makeCoffeep);
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/src/scripts/smart-coffee-machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ Assumes one medium americano if not specified, but time and mode are mandatory f
const paramsp = (await params.value()) as Record<string, unknown>; // : any = await Helpers.parseInteractionOutput(params);

// Check if uriVariables are provided
if (paramsp !== undefined && typeof paramsp === "object" && "time" in paramsp && "mode" in paramsp) {
if (paramsp && typeof paramsp === "object" && "time" in paramsp && "mode" in paramsp) {
// Use default values if not provided
paramsp.drinkId = "drinkId" in paramsp ? paramsp.drinkId : "americano";
paramsp.size = "size" in paramsp ? paramsp.size : "m";
Expand Down

0 comments on commit 100bdde

Please sign in to comment.