Function: normalizeHistoryLimit()
normalizeHistoryLimit(
candidate:number,rules?:HistoryLimitRules):number
Defined in: shared/constants/history.ts:81
Computes the effective history limit after applying business rules.
Parametersโ
candidateโ
number
History limit provided by a consumer.
rules?โ
HistoryLimitRules = DEFAULT_HISTORY_LIMIT_RULES
Rules to use when normalising the value. Defaults to the shared history limit rules used across the application.
Returnsโ
number
The normalised history limit ready for persistence.
Remarksโ
Validates that the candidate is a finite number within the supported bounds,
then clamps values below the minimum to the configured minimum while treating
zero or negative inputs as "unlimited" (represented as 0). Fractional
values above the minimum are floored.
Throwsโ
TypeError - When the candidate cannot be coerced into a number.
Throwsโ
RangeError - When the candidate is non-finite (for example
Infinity) or exceeds the configured maximum.