@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
16 lines (15 loc) • 848 B
JavaScript
"use client";
const require_is_options_group = require("./is-options-group.cjs");
//#region packages/@mantine/core/src/components/Combobox/OptionsDropdown/validate-options.ts
function validateOptions(options, valuesSet = /* @__PURE__ */ new Set()) {
if (!Array.isArray(options)) return;
for (const option of options) if (require_is_options_group.isOptionsGroup(option)) validateOptions(option.items, valuesSet);
else {
if (typeof option.value === "undefined") throw new Error("[@mantine/core] Each option must have value property");
if (valuesSet.has(option.value)) throw new Error(`[@mantine/core] Duplicate options are not supported. Option with value "${option.value}" was provided more than once`);
valuesSet.add(option.value);
}
}
//#endregion
exports.validateOptions = validateOptions;
//# sourceMappingURL=validate-options.cjs.map