From b9d3e0d98094df0a10ba178fc204b7353c0a5d33 Mon Sep 17 00:00:00 2001 From: Matthijs Smets <93487259+MatthijsSmets@users.noreply.github.com> Date: Mon, 15 Jul 2024 14:28:50 +0200 Subject: [PATCH] Feat: report util (#506) * refactor: create class for transforming report to hierarchy structure for reusability * feat: util to check if report is report or checkpoint --------- Co-authored-by: MarkvdVorst <34445874+MarkvdVorst@users.noreply.github.com> --- src/app/shared/util/report-util.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/app/shared/util/report-util.ts diff --git a/src/app/shared/util/report-util.ts b/src/app/shared/util/report-util.ts new file mode 100644 index 00000000..eef2e83f --- /dev/null +++ b/src/app/shared/util/report-util.ts @@ -0,0 +1,12 @@ +import { Report } from '../interfaces/report'; +import { Checkpoint } from '../interfaces/checkpoint'; + +export const ReportUtil = { + isReport(node: Report | Checkpoint): node is Report { + return !!(node as Report).xml; + }, + + isCheckPoint(node: Report | Checkpoint): node is Checkpoint { + return !!(node as Checkpoint).uid; + }, +};