UNPKG

mikroconf

Version:

A flexible, zero-dependency, type-safe configuration manager that just makes sense.

28 lines (26 loc) 865 B
/** * @description Common validators for config values. */ declare const validators: { /** * Validates that a file exists. */ fileExists: (path: string) => string | true; /** * @description Validates that a value is within a range. */ range: (min: number, max: number) => (value: number) => string | true; /** * @description Validates that a string matches a regex pattern. */ pattern: (regex: RegExp, message?: string) => (value: string) => string | true; /** * @description Validates that a value is one of a set of allowed values. */ oneOf: <T>(allowedValues: T[], message?: string) => (value: T) => string | true; /** * @description Validates that a string has minimum length. */ minLength: (min: number) => (value: string) => string | true; }; export { validators };