mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-02 15:02:38 +00:00
add language field validation (for future pr)
fix an oversight in validations
This commit is contained in:
@@ -1,17 +1,22 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
title : [
|
title : [
|
||||||
(value)=>{
|
(value)=>{
|
||||||
return value?.length > 10 ? 'Max title length of 10 characters' : null;
|
return value?.length > 100 ? 'Max title length of 100 characters' : null;
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
description : [
|
description : [
|
||||||
(value)=>{
|
(value)=>{
|
||||||
return value?.length > 10 ? 'Max description length of 10 characters' : null;
|
return value?.length > 500 ? 'Max description length of 500 characters.' : null;
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
thumbnail : [
|
thumbnail : [
|
||||||
(value)=>{
|
(value)=>{
|
||||||
return value?.length > 5 ? 'Max URL length of 5 characters' : null;
|
return value?.length > 256 ? 'Max URL length of 256 characters.' : null;
|
||||||
|
}
|
||||||
|
],
|
||||||
|
language : [
|
||||||
|
(value)=>{
|
||||||
|
return new RegExp(/[a-z]{2,3}(-.*)?/).test(value || '') === false ? 'Invalid language code.' : null;
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user