import * as check from "../../../../../generated/sync/check/dictionary-of/maybe/string"; import {AssertError} from "../../../../../sync/error/AssertError"; export function assertDictionaryOfMaybeString (name : string, mixed : any) : (((null|undefined|(string))|null|undefined)[])|never { const error = check.checkDictionaryOfMaybeString(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertDictionaryOfMaybeMinLength (name : string, mixed : any, min : number) : (((null|undefined|(string))|null|undefined)[])|never { const error = check.checkDictionaryOfMaybeMinLength(mixed, min); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, min); } } export function assertDictionaryOfMaybeMinLengthHandler (min : number) : (name : string, mixed : any) => (((null|undefined|(string))|null|undefined)[])|never { return (name : string, mixed : any) : (((null|undefined|(string))|null|undefined)[])|never => { return assertDictionaryOfMaybeMinLength(name, mixed, min); }; } export function assertDictionaryOfMaybeMaxLength (name : string, mixed : any, max : number) : (((null|undefined|(string))|null|undefined)[])|never { const error = check.checkDictionaryOfMaybeMaxLength(mixed, max); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, max); } } export function assertDictionaryOfMaybeMaxLengthHandler (max : number) : (name : string, mixed : any) => (((null|undefined|(string))|null|undefined)[])|never { return (name : string, mixed : any) : (((null|undefined|(string))|null|undefined)[])|never => { return assertDictionaryOfMaybeMaxLength(name, mixed, max); }; } export function assertDictionaryOfMaybeLength (name : string, mixed : any, args : { min? : number, max? : number }) : (((null|undefined|(string))|null|undefined)[])|never { const error = check.checkDictionaryOfMaybeLength(mixed, args); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, args); } } export function assertDictionaryOfMaybeLengthHandler (args : { min? : number, max? : number }) : (name : string, mixed : any) => (((null|undefined|(string))|null|undefined)[])|never { return (name : string, mixed : any) : (((null|undefined|(string))|null|undefined)[])|never => { return assertDictionaryOfMaybeLength(name, mixed, args); }; } export function assertDictionaryOfMaybeNonEmpty (name : string, mixed : any) : (((null|undefined|(string))|null|undefined)[])|never { const error = check.checkDictionaryOfMaybeNonEmpty(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertDictionaryOfMaybeContains (name : string, mixed : any, x : string) : (((null|undefined|(string))|null|undefined)[])|never { const error = check.checkDictionaryOfMaybeContains(mixed, x); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, x); } } export function assertDictionaryOfMaybeContainsHandler (x : string) : (name : string, mixed : any) => (((null|undefined|(string))|null|undefined)[])|never { return (name : string, mixed : any) : (((null|undefined|(string))|null|undefined)[])|never => { return assertDictionaryOfMaybeContains(name, mixed, x); }; } export function assertDictionaryOfMaybeNoDuplicate (name : string, mixed : any) : (((null|undefined|(string))|null|undefined)[])|never { const error = check.checkDictionaryOfMaybeNoDuplicate(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertDictionaryOfMaybeNotAllWhitespace (name : string, mixed : any) : (((null|undefined|(string))|null|undefined)[])|never { const error = check.checkDictionaryOfMaybeNotAllWhitespace(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertDictionaryOfMaybeNonEmptyAndNotAllWhitespace (name : string, mixed : any) : (((null|undefined|(string))|null|undefined)[])|never { const error = check.checkDictionaryOfMaybeNonEmptyAndNotAllWhitespace(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertDictionaryOfMaybeMatch (name : string, mixed : any, regex : RegExp) : (((null|undefined|(string))|null|undefined)[])|never { const error = check.checkDictionaryOfMaybeMatch(mixed, regex); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, regex); } } export function assertDictionaryOfMaybeMatchHandler (regex : RegExp) : (name : string, mixed : any) => (((null|undefined|(string))|null|undefined)[])|never { return (name : string, mixed : any) : (((null|undefined|(string))|null|undefined)[])|never => { return assertDictionaryOfMaybeMatch(name, mixed, regex); }; } export function assertDictionaryOfMaybeEmail (name : string, mixed : any) : (((null|undefined|(string))|null|undefined)[])|never { const error = check.checkDictionaryOfMaybeEmail(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertDictionaryOfMaybeNotOneOf (name : string, mixed : any, arr : T[]) : (((null|undefined|(string))|null|undefined)[])|never { const error = check.checkDictionaryOfMaybeNotOneOf(mixed, arr); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, arr); } } export function assertDictionaryOfMaybeNotOneOfHandler (arr : T[]) : (name : string, mixed : any) => (((null|undefined|(string))|null|undefined)[])|never { return (name : string, mixed : any) : (((null|undefined|(string))|null|undefined)[])|never => { return assertDictionaryOfMaybeNotOneOf(name, mixed, arr); }; } export function assertDictionaryOfMaybeBase64 (name : string, mixed : any) : (((null|undefined|(string))|null|undefined)[])|never { const error = check.checkDictionaryOfMaybeBase64(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertDictionaryOfMaybeJson (name : string, mixed : any) : (((null|undefined|(string))|null|undefined)[])|never { const error = check.checkDictionaryOfMaybeJson(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } }