UNPKG

clamp-it

Version:
20 lines (19 loc) 602 B
/** * Clamp values that must be greater than or equal to the given minimum. */ export declare function atLeast(minimum: number): Clamper; /** * Clamp values that must be less than or equal to the given minimum. */ export declare function atMost(maximum: number): Clamper; /** * Clamp values that must be bound within a given closed range. * The order of the arguments does not matter. */ export declare function within(a: number, b: number): Clamper; interface Clamper { clamp(value: number): number; atMost(maximum: number): Clamper; atLeast(minimum: number): Clamper; } export {};