@nouance/payload-better-fields-plugin
Version:
A Payload plugin that aims to provide improved fields for the admin panel
12 lines (11 loc) • 494 B
JavaScript
export const validate = (required)=>(value)=>{
if (!required && (!value || value === '')) {
return true;
} else if (required && (!value || value === '')) {
return 'This field is required.';
}
// Gotta validate the colour value in the future, validate-color is not ESM
// eslint-disable-next-line no-constant-binary-expression
return true || 'This is not a valid colour value.';
};
//# sourceMappingURL=validate.js.map