Skip to content
1 min read · 137 words

Function: resolveSearchLimit() ​

ts
function resolveSearchLimit(limit: number | undefined): number | undefined;

Defined in: src/batteries/sandbox/node/search_ripgrep.ts:78

Validate an explicit limit, permitting full omission (unbounded).

Parameters ​

ParameterTypeDescription
limitnumber | undefinedThe requested limit, or undefined for unbounded.

Returns ​

number | undefined

The validated limit, or undefined when unbounded.

Remarks ​

Issue #48: the contract previously mandated limit: number and the adapter rejected everything but a positive integer, so an UNBOUNDED search was inexpressible — the searcher forced a cap, and Number.MAX_SAFE_INTEGER is a disguised one. Omission is now the documented unbounded mode: no post-collection cap, the scan finishes complete: true. An EXPLICIT value must still be a positive integer — 0, negatives, non-integers, Infinity and NaN remain rejections, so a caller cannot accidentally disable the bound they named.