AniLink - v3.1.0
    Preparing search index...

    Function resolvePositiveInt

    • Resolve a numeric option with a fallback, throwing on defined-but-invalid values.

      A defined value that is not a finite, positive integer (for example perPage: -5, NaN, 0, or 2.7) is a caller bug and throws a TypeError instead of silently coercing to the fallback. A negative maxPages typo silently becoming a 100-page traversal is far harder to debug than a thrown error at the call site. This matches the fail-fast convention of resolveAgents and resolveRequestOptions. Fractional values are floored (the only defensible coercion for a count-like option); undefined falls back.

      Parameters

      • value: number | undefined

        The caller-supplied value (may be undefined).

      • fallback: number

        The default to use when value is undefined.

      • name: string = "option"

        The option name used in the error message.

      Returns number

      A positive, finite integer.

      A TypeError when value is defined but not a finite, positive number.