Function: normalizeLimit()
Gala Launchpad SDK 9.0.0-rc.5 / index / normalizeLimit
Function: normalizeLimit()
normalizeLimit(
limit,minLimit?,maxLimit?):number
Defined in: packages/launchpad-sdk/dist/utils/pagination-helpers.d.ts:117
Normalize limit to ensure it's within valid bounds
Ensures limit is between min and max bounds. Useful for enforcing server-side pagination constraints. Accepts undefined and returns minLimit.
Parameters
limit
number | undefined
Limit to normalize (undefined returns minLimit)
minLimit?
number
Minimum allowed limit (default: 1)
maxLimit?
number
Maximum allowed limit (default: PAGINATION_DEFAULTS.BACKEND_MAX_PAGE_SIZE)
Returns
number
Normalized limit within bounds
Example
normalizeLimit(undefined) // Returns: 1
normalizeLimit(0) // Returns: 1
normalizeLimit(100) // Returns: 20 (if maxLimit is 20)
normalizeLimit(10) // Returns: 10 (within bounds)
normalizeLimit(100, 1, 50) // Returns: 50 (custom max)
Since
6.5.0