import { RawSchema , rawSchemaToSchema } from "./rawSchemaToSchema" ; import { and , anySchema , array , arrayOf , boolean , custom , finite , functionSchema , max , maxLength , min , minLength , negative , neverSchema , not , number , pair , positive , safeInteger , SpecialProp , string , symbol , testSchema } from "./schemas" ; import { ITester , TCustomValidator } from "./types" ; export const methods = { and ( ... rawSchemas ) { return and ( rawSchemas . map ( rawSchemaToSchema ) ) ; } , any : anySchema ( ) , array : array ( ) , arrayOf ( rawElementSchema ) { const elementSchema = rawSchemaToSchema ( rawElementSchema ) ; return arrayOf ( elementSchema ) ; } , boolean : boolean ( ) , finite : finite ( ) , function : functionSchema ( ) , max ( maxValue , isExclusive = false ) { return max ( maxValue , isExclusive ) ; } , maxLength ( maxLengthValue , isExclusive = false ) { return maxLength ( maxLengthValue , isExclusive ) ; } , min ( minValue , isExclusive = false ) { return min ( minValue , isExclusive ) ; } , minLength ( minLengthValue , isExclusive = false ) { return minLength ( minLengthValue , isExclusive ) ; } , negative : negative ( ) , never : neverSchema ( ) , not ( rawSchema ) { const schema = rawSchemaToSchema ( rawSchema ) ; return not ( schema ) ; } , number : number ( ) , pair ( rawKeyValueSchema ) { const keyValueSchema = rawSchemaToSchema ( rawKeyValueSchema ) ; return pair ( keyValueSchema ) ; } , positive : positive ( ) , rest : SpecialProp . Rest as SpecialProp . Rest , restOmit : SpecialProp . RestOmit as SpecialProp . RestOmit , safeInteger : safeInteger ( ) , string : string ( ) , symbol : symbol ( ) , test ( tester ) { return testSchema ( tester ) ; } , custom ( customValidator , description ? ) { return custom ( customValidator , description ) ; } } ; export type IMethods = typeof methods ;