import { type MapFunction } from '../value/map'; export interface NumberBound { /** * The minimum value. */ readonly min: T; /** * The maximum value, inclusive. */ readonly max: T; } /** * Checks whether a {@link NumberBound} is valid (min is less than or equal to max). * * @param bounds - The bounds to validate. * @returns `true` if `min <= max` */ export declare function isValidNumberBound(bounds: NumberBound): boolean; export type IsInNumberBoundFunction = (number: number) => boolean; /** * Creates a function that checks whether a number falls within the specified inclusive bounds. * * @param bounds - The min/max bounds to test against. * @returns Returns `true` if the input number is within bounds. * @throws {Error} If the bounds are invalid (min > max) * * @dbxUtil * @dbxUtilCategory number * @dbxUtilKind factory * @dbxUtilTags number, bound, range, between, check, inclusive, factory * @dbxUtilRelated bound-number-function, bound-number, is-valid-number-bound * * @__NO_SIDE_EFFECTS__ */ export declare function isInNumberBoundFunction(bounds: NumberBound): IsInNumberBoundFunction; export interface WrapNumberFunctionConfig extends NumberBound { /** * Whether or not to wrap to the nearest "fencepost" value instead of by direct index. * * False by default. */ readonly fencePosts?: boolean; } export type WrapNumberFunction = MapFunction & { readonly _wrap: WrapNumberFunctionConfig; }; /** * Creates a function that wraps numbers around within the specified bounds, like modular arithmetic. * * When `fencePosts` is true, wraps to the nearest "fence post" value, extending the wrap range by one in each direction. * * @param wrapNumberFunctionConfig - Configuration with min, max, and optional fence post behavior. * @returns Wraps input numbers into the bounded range. * * @dbxUtil * @dbxUtilCategory number * @dbxUtilKind factory * @dbxUtilTags number, wrap, modulo, modular, range, factory, circular * @dbxUtilRelated bound-number-function, bound-number, is-in-number-bound-function * * @__NO_SIDE_EFFECTS__ */ export declare function wrapNumberFunction(wrapNumberFunctionConfig: WrapNumberFunctionConfig): WrapNumberFunction; export interface BoundNumberFunctionConfig extends NumberBound { /** * Whether or not to "wrap" values around. * * Example: Wrapping from -180 to 180 */ readonly wrap?: boolean; } export type BoundNumberFunction = MapFunction; /** * Creates a function that constrains numbers within bounds, either by clamping or wrapping. * * When `wrap` is true, uses modular wrapping. Otherwise, clamps values to the min/max range. * * @param boundNumberFunctionConfig - Configuration with min, max, and optional wrap behavior. * @returns Bounds input numbers into the configured range. * * @dbxUtil * @dbxUtilCategory number * @dbxUtilKind factory * @dbxUtilTags number, bound, clamp, wrap, range, factory, constrain * @dbxUtilRelated bound-number, wrap-number-function, is-in-number-bound-function * * @__NO_SIDE_EFFECTS__ */ export declare function boundNumberFunction(boundNumberFunctionConfig: BoundNumberFunctionConfig): BoundNumberFunction; /** * Clamps the input number between the min and max values (inclusive). * * @param input - Number to clamp. * @param min - Minimum allowed value. * @param max - Maximum allowed value. * @returns The clamped value. * * @dbxUtil * @dbxUtilCategory number * @dbxUtilTags number, clamp, bound, min, max, range, constrain * @dbxUtilRelated bound-number-function, wrap-number-function, is-in-number-bound-function */ export declare function boundNumber(input: number, min: T, max: T): T;