Page MenuHomeSealhub

url.ts
No OneTemporary

import { JDDContext } from "../jdd-context.js";
import { is, predicates } from "@sealcode/ts-predicates";
import { MaybePromise } from "../utils/util-types.js";
import { StringBasedArgument } from "./string-based-argument.js";
export class URL extends StringBasedArgument<string> {
public readonly urlType: Readonly<"relative" | "absolute">;
constructor(urlType: Readonly<"relative" | "absolute">) {
super();
this.urlType = urlType;
}
getTypeName() {
return `url`;
}
getEmptyValue() {
return "";
}
getExampleValue() {
if (this.urlType === "relative") {
return "/example";
}
return "https://example.com";
}
countWords(): number {
return 0;
}
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
Wed, May 7, 19:37 (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
625731
Default Alt Text
url.ts (865 B)

Event Timeline