@quenk/preconditions
Version:
Make data satisfy constraints before using.
31 lines (30 loc) • 967 B
TypeScript
import { Type } from '@quenk/noni/lib/data/type';
import { Precondition } from './';
/**
* gt test.
*/
export declare const gt: (target: number) => Precondition<number, number>;
/**
* lt test.
*/
export declare const lt: (target: number) => Precondition<number, number>;
/**
* range tests whether a number falls within a specified range.
*/
export declare const range: (min: number, max: number) => Precondition<number, number>;
/**
* min tests whether a value is more than or equal to the desired target.
*/
export declare const min: (target: number) => Precondition<number, number>;
/**
* max tests whether a value is less than or equal to the desired target.
*/
export declare const max: (target: number) => Precondition<number, number>;
/**
* isNumber tests if a value is a number.
*/
export declare const isNumber: Precondition<Type, number>;
/**
* toNumber casts a string to a number.
*/
export declare const toNumber: Precondition<Type, number>;