MCPcopy Create free account
hub / github.com/dfinity/nns-dapp / enumValues

Function enumValues

frontend/src/lib/utils/enum.utils.ts:6–12  ·  view source on GitHub ↗
(
  obj: T
)

Source from the content-addressed store, hash-verified

4 * e.g. enum Hello { World = 0; } => [0]
5 */
6export const enumValues = <T extends Record<string, unknown>>(
7 obj: T
8): number[] => {
9 return Object.values(obj).filter(
10 (o: unknown) => typeof o === "number"
11 ) as number[];
12};
13
14/**
15 * Return the keys of a number-based Enum

Calls

no outgoing calls

Tested by

no test coverage detected