Skip to content

Main content

Development: Source Map Base64 Vlq Sign Fold Tool

Fold one signed integer to the source-map VLQ sign-in-low-bit representation, not protobuf ZigZag and not a complete Base64 VLQ encoder.

Loading tool…

Description

Fold one signed integer for source-map Base64 VLQ.

A source-map segment separates field structure, signed deltas and Base64 VLQ serialization. Its sign fold is not the same as other signed integer encodings, and local field counts do not establish valid source positions.

Fold one signed integer for source-map Base64 VLQ.

When to use this tool

Use Development: Source Map Base64 Vlq Sign Fold when checking one explicit source-map field or sign convention.

How to use the tool and how it works

  1. Enter signedValue. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read result. Expand result to inspect the returned fields.

Fold one signed integer for source-map Base64 VLQ. Require whole signedValue in [-1000000000,1000000000]; return exact decimal 2*abs(n)+(n<0 ? 1 : 0).1

Source-map fields use signed delta values and Base64 VLQ conventions; one local field check does not validate a complete mapping.2

Input fieldMeaning and unitsAccepted input
signedValueSigned ValueRequired. Safe integer.
Output fieldInterpretationReturned shape
resultReturned object; expand its named members below.Required. Object.
result.foldedExact nonnegative decimal string: 2*abs(signedValue)+(signedValue<0 ? 1 : 0). This is source-map sign folding, not protobuf ZigZag.Calculated result member: string.
json
{
  "input": {
    "signedValue": -3
  },
  "output": {
    "result": {
      "folded": "7"
    }
  }
}

Limitations and assumptions

  • This sign-magnitude fold differs from protobuf ZigZag for negative values; no VLQ digits are emitted.
  • Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Use a conforming complete source-map parser and the actual source files when mapping generated code back to originals.

References

  1. Calculation and input contract: development/source-map-base64-vlq-sign-fold — tool.io

  2. ECMA-426: source map format — Ecma International

Similar or alternative tools