From 65c998dd0d8798f1ea1ee321bb490d5b94074f0c Mon Sep 17 00:00:00 2001 From: Matt Gibson Date: Fri, 30 Jul 2021 13:57:42 -0500 Subject: [PATCH] Iterate over enum values (#445) --- common/src/misc/utils.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/src/misc/utils.ts b/common/src/misc/utils.ts index 0cc6b8a0c0..e353fcbfec 100644 --- a/common/src/misc/utils.ts +++ b/common/src/misc/utils.ts @@ -296,6 +296,11 @@ export class Utils { return Object.assign(target, source); } + static iterateEnum(obj: O) { + return (Object.keys(obj).filter(k => Number.isNaN(+k)) as K[]).map(k => obj[k]); + } + + static getUrl(uriString: string): URL { if (uriString == null) { return null;