@nish1896/rhf-mui-components
Version:
A suite of 20+ reusable Material UI components for React Hook Form to minimize your time and effort in creating and styling forms
16 lines (15 loc) • 634 B
JavaScript
export function isKeyValueOption(option, labelKey, valueKey) {
if (typeof option !== 'object' || option === null) {
return false;
}
if (!labelKey || !valueKey) {
return false;
}
return labelKey in option && valueKey in option;
}
export function generateLabelValueErrMsg(formElement) {
return `Provide "labelKey" & "valueKey" props in ${formElement} if options are an array of objects.`;
}
export function generateDateAdapterErrMsg(formElement) {
return `Missing "dateAdapter" for ${formElement}. Please wrap your component tree with "ConfigProvider dateAdapter={...}>" to configure it.`;
}