Page MenuHomeSealhub

simple-form-field.ts
No OneTemporary

simple-form-field.ts

import { FormDataValue } from "../form-types.js";
import { Context } from "koa";
import { predicates } from "@sealcode/ts-predicates";
import { FieldParseResult, FormField } from "./field.js";
export class SimpleFormField<Required extends boolean> extends FormField<
Required,
string | null
> {
async parse(
_: Context,
raw_value: FormDataValue
): Promise<FieldParseResult<string>> {
return {
parsed_value: (raw_value || "").toString(),
parsable: true,
error: null,
};
}
predicate = predicates.string;
public getEmptyValue(): string {
return "";
}
constructor(required: Required) {
super(required);
}
}

File Metadata

Mime Type
text/x-java
Expires
Sat, Jun 7, 23:21 (15 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
625635
Default Alt Text
simple-form-field.ts (638 B)

Event Timeline