mirror of
https://github.com/ZwareBear/awx.git
synced 2026-03-24 09:43:35 -05:00
21 lines
429 B
JavaScript
21 lines
429 B
JavaScript
import { i18nMark } from '@lingui/react';
|
|
|
|
export function required (message) {
|
|
return value => {
|
|
if (!value.trim()) {
|
|
return message || i18nMark('This field must not be blank');
|
|
}
|
|
return undefined;
|
|
};
|
|
}
|
|
|
|
export function maxLength (max) {
|
|
return value => {
|
|
if (value.trim().length
|
|
> max) {
|
|
return i18nMark(`This field must not exceed ${max} characters`);
|
|
}
|
|
return undefined;
|
|
};
|
|
}
|