enumReverseMap | WebHare Platform SDKWebHare Platform SDKPreparing search index...@webhare/stdenumReverseMapFunction enumReverseMapenumReverseMap< const T extends Record<string, string | number>, const V extends number,>( enumObj: T, value: V,): EnumEntries<T, V, keyof T>[0]Returns the reverse mapping of a value of an const object used as enum. Can only be used for numbers. Type Parametersconst T extends Record<string, string | number>const V extends numberParametersenumObj: TThe enum object to reverse map. value: VThe value to look up in the reverse map. Returns EnumEntries<T, V, keyof T>[0]The key corresponding to the given value in the enum object. Exampleconst Color = { Red: 1, Green: 2, Blue: 3} as const;const key = enumReverseMap(Color, 2); // "Green" Copy SettingsMember VisibilityProtectedInheritedThemeOSLightDarkWebHare Platform SDKLoading...
Returns the reverse mapping of a value of an const object used as enum. Can only be used for numbers.