shelving
Version:
Toolkit for using data in JavaScript.
18 lines (17 loc) • 691 B
TypeScript
import { StringSchema, type StringSchemaOptions } from "./StringSchema.js";
/**
* Define a valid database key.
*
* - Characters that are not a-z, A-Z, 0-9 are removed.
* - Default minimum key length is 1 character.
* - Default maximum key length is 32 characters.
* - 32 characters is enough for UUIDs, as the 4 `-` hyphens are removed.
*/
export declare class KeySchema extends StringSchema {
constructor({ min, max, ...options }: StringSchemaOptions);
sanitize(str: string): string;
}
/** Valid database key. */
export declare const KEY: KeySchema;
/** Valid optional database key. */
export declare const OPTIONAL_KEY: import("./OptionalSchema.js").OptionalSchema<string>;