import * as check from "../../../../../generated/sync/check/maybe/string-format/date"; import {AssertError} from "../../../../../sync/error/AssertError"; export function assertMaybePotentiallyUnsafeDateString (name : string, mixed : any) : (null|undefined|(string))|never { const error = check.checkMaybePotentiallyUnsafeDateString(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertMaybeValidDateString (name : string, mixed : any) : (null|undefined|(string))|never { const error = check.checkMaybeValidDateString(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertMaybeBeforeString (name : string, mixed : any, x : Date) : (null|undefined|(string))|never { const error = check.checkMaybeBeforeString(mixed, x); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, x); } } export function assertMaybeBeforeStringHandler (x : Date) : (name : string, mixed : any) => (null|undefined|(string))|never { return (name : string, mixed : any) : (null|undefined|(string))|never => { return assertMaybeBeforeString(name, mixed, x); }; } export function assertMaybeAfterString (name : string, mixed : any, x : Date) : (null|undefined|(string))|never { const error = check.checkMaybeAfterString(mixed, x); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, x); } } export function assertMaybeAfterStringHandler (x : Date) : (name : string, mixed : any) => (null|undefined|(string))|never { return (name : string, mixed : any) : (null|undefined|(string))|never => { return assertMaybeAfterString(name, mixed, x); }; } export function assertMaybeBeforeOrAtString (name : string, mixed : any, x : Date) : (null|undefined|(string))|never { const error = check.checkMaybeBeforeOrAtString(mixed, x); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, x); } } export function assertMaybeBeforeOrAtStringHandler (x : Date) : (name : string, mixed : any) => (null|undefined|(string))|never { return (name : string, mixed : any) : (null|undefined|(string))|never => { return assertMaybeBeforeOrAtString(name, mixed, x); }; } export function assertMaybeAfterOrAtString (name : string, mixed : any, x : Date) : (null|undefined|(string))|never { const error = check.checkMaybeAfterOrAtString(mixed, x); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, x); } } export function assertMaybeAfterOrAtStringHandler (x : Date) : (name : string, mixed : any) => (null|undefined|(string))|never { return (name : string, mixed : any) : (null|undefined|(string))|never => { return assertMaybeAfterOrAtString(name, mixed, x); }; } export function assertMaybeRangeString (name : string, mixed : any, args : { min? : Date, max? : Date }) : (null|undefined|(string))|never { const error = check.checkMaybeRangeString(mixed, args); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, args); } } export function assertMaybeRangeStringHandler (args : { min? : Date, max? : Date }) : (name : string, mixed : any) => (null|undefined|(string))|never { return (name : string, mixed : any) : (null|undefined|(string))|never => { return assertMaybeRangeString(name, mixed, args); }; }