Page MenuHomeSealhub

short-text.ts
No OneTemporary

short-text.ts

import { is, predicates } from "@sealcode/ts-predicates";
import { JDDContext } from "../index.js";
import { MaybePromise } from "../utils/util-types.js";
import { StringBasedArgument } from "./string-based-argument.js";
export class ShortText extends StringBasedArgument<string> {
example_values = [
"Lorem ipsum set doloris",
"Main hippopotomonsti delos muertos",
"Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore",
"Ipsum",
];
getTypeName() {
return "short-text";
}
getEmptyValue() {
return "";
}
countWords(value: string): number {
return value.toString().split(" ").length;
}
parseFormInput(
_: JDDContext,
input: unknown
): MaybePromise<string | string[] | null> {
if (is(input, predicates.string)) {
return input;
} else {
return null;
}
}
}

File Metadata

Mime Type
text/x-Algol68
Expires
Tue, Dec 24, 14:02 (1 d, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557135
Default Alt Text
short-text.ts (818 B)

Event Timeline