MCPcopy
hub / github.com/autobase-tech/autobase / configValidationSchema

Function configValidationSchema

console/ui/src/shared/model/validation.ts:4–16  ·  view source on GitHub ↗
(t: TFunction)

Source from the content-addressed store, hash-verified

2import { TFunction } from 'i18next';
3
4export const configValidationSchema = (t: TFunction) =>
5 yup.string().test('should have correct format', t('configFormat', { ns: 'validation' }), (value) => {
6 if (value == null || value === '') {
7 return true;
8 }
9
10 const lines = value
11 .split(/\r?\n/)
12 .map((line) => line.trim())
13 .filter(Boolean);
14
15 return lines.length > 0 && lines.every((line) => /^[^:=\n\r]+[:=][^\n\r]+$/i.test(line));
16 });

Calls

no outgoing calls

Tested by

no test coverage detected