@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
35 lines (34 loc) • 917 B
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const hasValidOptionIndex = (option) => !option.index || typeof option.index === "number";
const hasValidOptionValue = (option) => {
if (!option.value) {
return false;
}
return typeof option.value === "string" || typeof option.value === "number";
};
const hasValidOptionLabel = (option) => {
if (!option.label) {
return false;
}
return typeof option.label === "string";
};
const optionsValidator = (options) => {
if (!options) {
return true;
}
return options.every((option) => {
if (!hasValidOptionIndex(option)) {
return false;
}
if (!hasValidOptionValue(option)) {
return false;
}
if (!hasValidOptionLabel(option)) {
return false;
}
return true;
});
};
exports.optionsValidator = optionsValidator;
//# sourceMappingURL=select_menu_validators.cjs.map