mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
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;
|
|
};
|
|
}
|