From fee7c56eb4cee5bfbf67a6319470e475b27a9617 Mon Sep 17 00:00:00 2001 From: Hasan Eroglu Date: Sun, 21 Jul 2024 20:48:00 +0200 Subject: [PATCH 1/4] refactor: remove unused findProtocol and findPort functions Signed-off-by: Hasan Eroglu --- packages/td-tools/src/td-helpers.ts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/packages/td-tools/src/td-helpers.ts b/packages/td-tools/src/td-helpers.ts index 521e1b78e..fc1d0f78b 100644 --- a/packages/td-tools/src/td-helpers.ts +++ b/packages/td-tools/src/td-helpers.ts @@ -23,21 +23,6 @@ import ThingDescription from "./thing-description"; -// need two tests -export function findProtocol(td: ThingDescription): string { - const base: string = td.base; - const columnLoc: number = base.indexOf(":"); - return base.substring(0, columnLoc); -} - -export function findPort(td: ThingDescription): number { - const base: string = td.base; - const columnLoc: number = base.indexOf(":", 6); - const divLoc: number = base.indexOf("/", columnLoc); - const returnString: string = base.substring(columnLoc + 1, divLoc); - return parseInt(returnString); -} - export function setContextLanguage(thing: ThingDescription, language: string, forceOverride: boolean): void { // forceOverride == false -> set @language if no @language set // forceOverride == true -> set/override @language in any case From 4aaf13d56df3e703db468f0acc7baf9bee0dbe75 Mon Sep 17 00:00:00 2001 From: Hasan Eroglu Date: Mon, 22 Jul 2024 14:19:59 +0200 Subject: [PATCH 2/4] Revert "refactor: remove unused findProtocol and findPort functions" This reverts commit fee7c56eb4cee5bfbf67a6319470e475b27a9617. Signed-off-by: Hasan Eroglu --- packages/td-tools/src/td-helpers.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/td-tools/src/td-helpers.ts b/packages/td-tools/src/td-helpers.ts index fc1d0f78b..521e1b78e 100644 --- a/packages/td-tools/src/td-helpers.ts +++ b/packages/td-tools/src/td-helpers.ts @@ -23,6 +23,21 @@ import ThingDescription from "./thing-description"; +// need two tests +export function findProtocol(td: ThingDescription): string { + const base: string = td.base; + const columnLoc: number = base.indexOf(":"); + return base.substring(0, columnLoc); +} + +export function findPort(td: ThingDescription): number { + const base: string = td.base; + const columnLoc: number = base.indexOf(":", 6); + const divLoc: number = base.indexOf("/", columnLoc); + const returnString: string = base.substring(columnLoc + 1, divLoc); + return parseInt(returnString); +} + export function setContextLanguage(thing: ThingDescription, language: string, forceOverride: boolean): void { // forceOverride == false -> set @language if no @language set // forceOverride == true -> set/override @language in any case From 4b90ff3ff5fc71aba903f10b78ae5e35f355ca1c Mon Sep 17 00:00:00 2001 From: Hasan Eroglu Date: Mon, 22 Jul 2024 14:23:01 +0200 Subject: [PATCH 3/4] refactor(td-tools): deprecate findProtocol and findPort Signed-off-by: Hasan Eroglu --- packages/td-tools/src/td-helpers.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/td-tools/src/td-helpers.ts b/packages/td-tools/src/td-helpers.ts index 521e1b78e..7fa33bc61 100644 --- a/packages/td-tools/src/td-helpers.ts +++ b/packages/td-tools/src/td-helpers.ts @@ -23,13 +23,20 @@ import ThingDescription from "./thing-description"; -// need two tests + +/** + * @deprecated This function will be removed in the future. Please use '@thingweb/td-utils' package instead. + */ export function findProtocol(td: ThingDescription): string { const base: string = td.base; const columnLoc: number = base.indexOf(":"); return base.substring(0, columnLoc); } + +/** + * @deprecated This function will be removed in the future. Please use '@thingweb/td-utils' package instead. + */ export function findPort(td: ThingDescription): number { const base: string = td.base; const columnLoc: number = base.indexOf(":", 6); From 901a3cb40ee7818a9a3477af5f6e0c8021dc3089 Mon Sep 17 00:00:00 2001 From: Hasan Eroglu Date: Mon, 22 Jul 2024 14:23:56 +0200 Subject: [PATCH 4/4] refactor(td-tools): run prettier Signed-off-by: Hasan Eroglu --- packages/td-tools/src/td-helpers.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/td-tools/src/td-helpers.ts b/packages/td-tools/src/td-helpers.ts index 7fa33bc61..3efa4ec77 100644 --- a/packages/td-tools/src/td-helpers.ts +++ b/packages/td-tools/src/td-helpers.ts @@ -23,7 +23,6 @@ import ThingDescription from "./thing-description"; - /** * @deprecated This function will be removed in the future. Please use '@thingweb/td-utils' package instead. */ @@ -33,7 +32,6 @@ export function findProtocol(td: ThingDescription): string { return base.substring(0, columnLoc); } - /** * @deprecated This function will be removed in the future. Please use '@thingweb/td-utils' package instead. */