Iterate over enum values (#445)
This commit is contained in:
parent
fdf0eb989b
commit
65c998dd0d
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue