MCPcopy Index your code
hub / github.com/Lemoncode/fonk / validator

Function validator

src/validators/pattern.ts:30–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30export const validator: FieldValidationFunctionSync = fieldValidatorArgs => {
31 if (!fieldValidatorArgs.customArgs) {
32 throw new Error(BAD_PARAMETER);
33 }
34 const {
35 value,
36 customArgs = DEFAULT_PARAMS as PatternArgs,
37 message = defaultMessage,
38 } = fieldValidatorArgs;
39
40 const pattern = parsePattern(customArgs);
41 const succeeded = isValidPattern(value, pattern);
42
43 return {
44 succeeded,
45 message: succeeded
46 ? ''
47 : parseMessageWithCustomArgs(message as string, customArgs),
48 type: VALIDATOR_TYPE,
49 };
50};

Callers 1

pattern.spec.tsFile · 0.90

Calls 3

isValidPatternFunction · 0.90
parsePatternFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…