svelidate
Version:
Simple and lightweight form validation for Svelte with no dependencies
24 lines (23 loc) • 1.36 kB
TypeScript
import type { HtmlDateTimeInputType, SvelidateInputType } from "../types/html";
import type { ByteUnit } from "../types/misc";
import { addSubstract } from "./constants";
export declare function mergeObjects(obj1: Record<PropertyKey, any>, obj2: Record<PropertyKey, any>): void;
export declare function isLookahead(pattern: string): boolean;
/**
* Returns `value` as a `Date` if it is one or can be parsed as one or undefined.
*/
export declare function getDate(value: unknown): Date | undefined;
/**
* Returns a bigger or smaller date from the given one depending on the `mode` & `inputType`.
* It will add/substract the minimum amount of time depending on the `inputType`.
*/
export declare function getExcludedDate(date: Date, inputType: SvelidateInputType, mode: keyof typeof addSubstract): Date | undefined;
/**
* Returns a string corresponding to the correct date format for the given `inputType`.
*/
export declare function getFormattedDate(date: Date, inputType: HtmlDateTimeInputType): string;
export declare function getExtension(filename: string): string | undefined;
export declare function isVideo(filename: string): boolean;
export declare function isAudio(filename: string): boolean;
export declare function isImage(filename: string, type?: "raster" | "vector"): boolean;
export declare function toBytes(size: number, unit: ByteUnit): number;