@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
31 lines (28 loc) • 736 B
JavaScript
'use client';
;
function parseItem(item) {
if (typeof item === "string") {
return { value: item, label: item };
}
if ("value" in item && !("label" in item)) {
return { value: item.value, label: item.value, disabled: item.disabled };
}
if (typeof item === "number") {
return { value: item.toString(), label: item.toString() };
}
if ("group" in item) {
return {
group: item.group,
items: item.items.map((i) => parseItem(i))
};
}
return item;
}
function getParsedComboboxData(data) {
if (!data) {
return [];
}
return data.map((item) => parseItem(item));
}
exports.getParsedComboboxData = getParsedComboboxData;
//# sourceMappingURL=get-parsed-combobox-data.cjs.map