Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
Iterate over enum values (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
MGibson1 committed Jul 30, 2021
1 parent fdf0eb9 commit 65c998d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions common/src/misc/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ export class Utils {
return Object.assign(target, source);
}

static iterateEnum<O extends object, K extends keyof O = keyof O>(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;
Expand Down

0 comments on commit 65c998d

Please sign in to comment.