UNPKG

regex-friendly

Version:

Readable regex transformations, validations, and utilities with both static and chainable API.

21 lines (20 loc) 943 B
import { transformations } from "./transformations"; import { validations } from "./validations"; import { advanced } from "./advanced"; import { rexFunctions } from "./functions"; type Transformations = typeof transformations; type Validations = typeof validations; type Advanced = typeof advanced; type REXFunctions = typeof rexFunctions; type Tail<F extends (arg0: any, ...args: any[]) => any> = F extends (arg0: any, ...args: infer A) => any ? A : never; type Chainable = { [K in keyof Transformations]: (...args: Tail<Transformations[K]>) => Chainable; } & { [K in keyof Validations]: (...args: Tail<Validations[K]>) => boolean; } & { result: () => string; }; export type RegexFriendlyType = ((input?: string) => Chainable) & Transformations & Validations & Advanced & REXFunctions; declare const RegexFriendly: RegexFriendlyType; export default RegexFriendly; export { transformations, validations, advanced, rexFunctions };