@metreeca/http - v0.1.1
    Preparing search index...

    Function parseInteger

    • Parses a numeric field value.

      Note

      A number a peer states is plain digits and nothing else, so a sign, a decimal point or an exponent marks a value no peer is required to understand: it is reported as missing rather than repaired, leaving the consumer to decide what to make of it.

      How large a number may grow is settled by each field rather than by HTTP at large, so the ceiling is the caller's to state. It defaults to the greatest number JavaScript counts exactly, past which arithmetic would quietly drift.

      Parameters

      • value: Nullable<string>

        The field value to be parsed, possibly missing

      • limit: number = Number.MAX_SAFE_INTEGER

        The greatest number to be reported, standing in for anything larger

      Returns number | undefined

      The number value states, never negative and never above limit; undefined if value is missing or states anything but a bare sequence of digits