validata
Version:
Type safe data validation and sanitization
14 lines (13 loc) • 1.23 kB
TypeScript
import { CommonConvertOptions, CommonValidationOptions, MaybeOptions, WithDefault } from './common';
import { ValueProcessor } from './types';
interface ValidationOptions<T> extends CommonValidationOptions<T> {
keyRegex?: RegExp;
maxKeys?: number;
minKeys?: number;
}
export type RecordOptions<T> = ValidationOptions<T>;
export declare const isRecord: <V>(check?: ValueProcessor<V> | undefined, options?: RecordOptions<Record<string, V>> | undefined) => ValueProcessor<Record<string, V>>;
export declare const maybeRecord: <V>(check?: ValueProcessor<V> | undefined, options?: (RecordOptions<Record<string, V>> & MaybeOptions) | undefined) => ValueProcessor<Record<string, V> | undefined>;
export declare const asRecord: <V>(check?: ValueProcessor<V> | undefined, options?: (RecordOptions<Record<string, V>> & WithDefault<Record<string, V>> & CommonConvertOptions<Record<string, V>>) | undefined) => ValueProcessor<Record<string, V>>;
export declare const maybeAsRecord: <V>(check?: ValueProcessor<V> | undefined, options?: (RecordOptions<Record<string, V>> & MaybeOptions & WithDefault<Record<string, V>> & CommonConvertOptions<Record<string, V>>) | undefined) => ValueProcessor<Record<string, V> | undefined>;
export {};