Page MenuHomeSealhub

validator.ts
No OneTemporary

validator.ts

import { BaseContext } from "koa";
import { Field } from "sealious";
import { FieldParsedValue } from "..";
import { FormFieldValidationFn } from "./field";
export function collectionFieldValidator<F extends Field>(
field: F
): FormFieldValidationFn<FieldParsedValue<F>> {
return async (ctx: BaseContext, value) => {
const { valid, reason } = await field.checkValue(
ctx.$context,
value,
undefined
);
return { valid, message: reason || (valid ? "Wrong value" : "") };
};
}

File Metadata

Mime Type
text/x-java
Expires
Wed, May 7, 19:43 (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
674556
Default Alt Text
validator.ts (492 B)

Event Timeline