mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 16:22:44 +00:00
35 lines
675 B
JavaScript
35 lines
675 B
JavaScript
module.exports = {
|
|
title : [
|
|
(value)=>{
|
|
return value?.length > 100 ? 'Max title length of 100 characters' : null;
|
|
}
|
|
],
|
|
description : [
|
|
(value)=>{
|
|
return value?.length > 500 ? 'Max description length of 500 characters.' : null;
|
|
}
|
|
],
|
|
thumbnail : [
|
|
(value)=>{
|
|
return value?.length > 256 ? 'Max URL length of 256 characters.' : null;
|
|
},
|
|
(value)=>{
|
|
if(value?.length == 0){return null;}
|
|
try {
|
|
Boolean(new URL(value));
|
|
return null;
|
|
} catch (e) {
|
|
return 'Must be a valid URL';
|
|
}
|
|
}
|
|
],
|
|
language : [
|
|
(value)=>{
|
|
return new RegExp(/[a-z]{2,3}(-.*)?/).test(value || '') === false ? 'Invalid language code.' : null;
|
|
}
|
|
]
|
|
};
|
|
|
|
|
|
|