import * as check from "../../../../generated/sync/check/string-format/number"; import {AssertError} from "../../../../sync/error/AssertError"; export function assertPotentiallyUnsafeNumberString (name : string, mixed : any) : (string)|never { const error = check.checkPotentiallyUnsafeNumberString(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertFiniteNumberString (name : string, mixed : any) : (string)|never { const error = check.checkFiniteNumberString(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertIntegerString (name : string, mixed : any) : (string)|never { const error = check.checkIntegerString(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertGreaterThanString (name : string, mixed : any, x : number) : (string)|never { const error = check.checkGreaterThanString(mixed, x); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, x); } } export function assertGreaterThanStringHandler (x : number) : (name : string, mixed : any) => (string)|never { return (name : string, mixed : any) : (string)|never => { return assertGreaterThanString(name, mixed, x); }; } export function assertGreaterThanOrEqualString (name : string, mixed : any, x : number) : (string)|never { const error = check.checkGreaterThanOrEqualString(mixed, x); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, x); } } export function assertGreaterThanOrEqualStringHandler (x : number) : (name : string, mixed : any) => (string)|never { return (name : string, mixed : any) : (string)|never => { return assertGreaterThanOrEqualString(name, mixed, x); }; } export function assertLessThanString (name : string, mixed : any, x : number) : (string)|never { const error = check.checkLessThanString(mixed, x); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, x); } } export function assertLessThanStringHandler (x : number) : (name : string, mixed : any) => (string)|never { return (name : string, mixed : any) : (string)|never => { return assertLessThanString(name, mixed, x); }; } export function assertLessThanOrEqualString (name : string, mixed : any, x : number) : (string)|never { const error = check.checkLessThanOrEqualString(mixed, x); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, x); } } export function assertLessThanOrEqualStringHandler (x : number) : (name : string, mixed : any) => (string)|never { return (name : string, mixed : any) : (string)|never => { return assertLessThanOrEqualString(name, mixed, x); }; } export function assertRangeString (name : string, mixed : any, args : { min? : number, max? : number }) : (string)|never { const error = check.checkRangeString(mixed, args); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, args); } } export function assertRangeStringHandler (args : { min? : number, max? : number }) : (name : string, mixed : any) => (string)|never { return (name : string, mixed : any) : (string)|never => { return assertRangeString(name, mixed, args); }; } export function assertPositiveString (name : string, mixed : any) : (string)|never { const error = check.checkPositiveString(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertNegativeString (name : string, mixed : any) : (string)|never { const error = check.checkNegativeString(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertNonNegativeString (name : string, mixed : any) : (string)|never { const error = check.checkNonNegativeString(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertNaturalNumberString (name : string, mixed : any) : (string)|never { const error = check.checkNaturalNumberString(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertOddString (name : string, mixed : any) : (string)|never { const error = check.checkOddString(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertEvenString (name : string, mixed : any) : (string)|never { const error = check.checkEvenString(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertNotOneOfString (name : string, mixed : any, arr : T[]) : (string)|never { const error = check.checkNotOneOfString(mixed, arr); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed, arr); } } export function assertNotOneOfStringHandler (arr : T[]) : (name : string, mixed : any) => (string)|never { return (name : string, mixed : any) : (string)|never => { return assertNotOneOfString(name, mixed, arr); }; } export function assertLatitudeString (name : string, mixed : any) : (string)|never { const error = check.checkLatitudeString(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } } export function assertLongitudeString (name : string, mixed : any) : (string)|never { const error = check.checkLongitudeString(mixed); if (error === undefined) { return mixed; } else { throw new AssertError(name, error, mixed); } }