UNPKG

@elastic-suite/gally-admin-shared

Version:
14 lines (11 loc) 301 B
import { TFunction } from 'i18next' import { IOptions } from '../types' export function getOptionsFromEnum<T extends string | number>( enumObject: Record<string, T>, t: TFunction ): IOptions<T> { return Object.entries(enumObject).map(([key, value]) => ({ value, label: t(key), })) }