From 100bdde97c78765c2f7508de89b71818017511b5 Mon Sep 17 00:00:00 2001 From: danielpeintner Date: Wed, 20 Sep 2023 09:47:31 +0200 Subject: [PATCH] refactor: revert changes in package "examples" --- packages/examples/src/scripts/countdown.ts | 6 +++--- .../examples/src/scripts/smart-coffee-machine-client.ts | 2 +- packages/examples/src/scripts/smart-coffee-machine.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/examples/src/scripts/countdown.ts b/packages/examples/src/scripts/countdown.ts index f65306204..fa7c2e25c 100644 --- a/packages/examples/src/scripts/countdown.ts +++ b/packages/examples/src/scripts/countdown.ts @@ -127,7 +127,7 @@ WoT.produce({ "startCountdown", async (params: WoT.InteractionOutput, options): Promise => { let initValue = 100; - if (params !== undefined) { + if (params) { const value = await params.value(); if (typeof value === "number") { initValue = value as number; @@ -147,7 +147,7 @@ WoT.produce({ thing.setActionHandler( "stopCountdown", async (params: WoT.InteractionOutput, options): Promise => { - if (params !== undefined) { + if (params) { const value = await params.value(); if (typeof value === "string" && countdowns.has(value)) { const as = countdowns.get(value); @@ -170,7 +170,7 @@ WoT.produce({ thing.setActionHandler( "monitorCountdown", async (params: WoT.InteractionOutput, options): Promise => { - if (params !== undefined) { + if (params) { const value = await params.value(); if (typeof value === "string" && countdowns.has(value)) { const as = countdowns.get(value); diff --git a/packages/examples/src/scripts/smart-coffee-machine-client.ts b/packages/examples/src/scripts/smart-coffee-machine-client.ts index 767cba1ef..05e745c35 100644 --- a/packages/examples/src/scripts/smart-coffee-machine-client.ts +++ b/packages/examples/src/scripts/smart-coffee-machine-client.ts @@ -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; - if (makeCoffeep.result !== undefined) { + if (makeCoffeep.result) { log("Enjoy your drink!", makeCoffeep); } else { log("Failed making your drink:", makeCoffeep); diff --git a/packages/examples/src/scripts/smart-coffee-machine.ts b/packages/examples/src/scripts/smart-coffee-machine.ts index 17f11a225..896ebe947 100644 --- a/packages/examples/src/scripts/smart-coffee-machine.ts +++ b/packages/examples/src/scripts/smart-coffee-machine.ts @@ -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; // : 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";