From f965766ab5d5b0d687deb77da96778f37bf6ccb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <git@minelli.me> Date: Fri, 29 Mar 2024 02:03:13 +0100 Subject: [PATCH] Toolbox => Add isString function --- helpers/Toolbox.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/helpers/Toolbox.ts b/helpers/Toolbox.ts index cda5693..d0fbfd5 100644 --- a/helpers/Toolbox.ts +++ b/helpers/Toolbox.ts @@ -51,6 +51,10 @@ class Toolbox { public getKeysWithPrefix(obj: object, prefix: string): Array<string> { return Object.keys(obj).filter(key => key.startsWith(prefix)); } + + public isString(value: unknown): value is string { + return typeof value === 'string' || value instanceof String; + } } -- GitLab