export interface Item { value: string label: string code?: string priority?: number } export function recStrToItem(input: Record): Item[] { const items: Item[] = [] let idx = 0 for (const key in input) { if (input.hasOwnProperty(key)) { items.push({ value: key || 'unknown-' + idx, label: input[key] || 'unknown-' + idx, }) } idx++ } return items } export function objectsToItems(input: object[], key = 'id', label = 'name'): Item[] { const items: Item[] = [] for (const item of input) { if (item.hasOwnProperty(key) && item.hasOwnProperty(label)) { items.push({ value: item[key as keyof typeof item], // the hasOwnProperty check should be enough label: item[label as keyof typeof item], // the hasOwnProperty check should be enough }) } } return items } export { default as Combobox } from './combobox.vue'