You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
488 B
18 lines
488 B
7 months ago
|
import * as yup from 'yup';
|
||
|
|
||
|
import { REP_IPV4, REP_UUID } from './consts/REG_EXP_PATTERNS';
|
||
|
|
||
|
/**
|
||
|
* This is OK because yup uses the template string syntax internally to access
|
||
|
* the field name.
|
||
|
*/
|
||
|
/* eslint-disable no-template-curly-in-string */
|
||
|
|
||
|
export const yupLaxUuid = () =>
|
||
|
yup.string().matches(REP_UUID, { message: '${path} must be a valid UUID' });
|
||
|
|
||
|
export const yupIpv4 = () =>
|
||
|
yup
|
||
|
.string()
|
||
|
.matches(REP_IPV4, { message: '${path} must be a valid IPv4 address' });
|