Skip to content

Main content

SemVer Core Component Distance

Return signed componentwise SemVer core deltas as arithmetic evidence, not a scalar version distance or compatibility metric.

Loading tool…

Description

Return signed componentwise SemVer core deltas as arithmetic evidence, not a scalar version distance or compatibility metric.

Semantic versions have a major.minor.patch core, optional prerelease identifiers after a hyphen, and build identifiers after a plus. Prereleases precede the corresponding release; build metadata does not affect precedence. A textual spelling, an equal-precedence group and a major.minor release lane therefore answer different questions.1

Return signed componentwise SemVer core deltas as arithmetic evidence, not a scalar version distance or compatibility metric.

When to use this tool

Use this tool to return signed componentwise SemVer core deltas as arithmetic evidence, not a scalar version distance or compatibility metric.

How to use the tool and how it works

  1. Enter left, right using the field definitions below.
  2. Run the operation. Correct input errors before interpreting an output.
  3. Read result.delta. Use the ordering, boundary rules and absence conditions described below.

Subtract each left core component from its corresponding right component and return the signed major, minor and patch deltas.2

Input fieldMeaning and unitsAccepted input
leftLeft semantic version for comparison or subtraction.Text, at most 8,192 UTF-16 code units; the operation’s grammar also applies.
rightRight semantic version for comparison or subtraction.Text, at most 8,192 UTF-16 code units; the operation’s grammar also applies.
Output fieldInterpretation
resultObject containing the named fields below.
result.deltaSigned right-minus-left core differences in major, minor and patch.
json
{
  "input": {
    "left": "1.2.3",
    "right": "2.0.0"
  },
  "output": {
    "result": {
      "delta": {
        "major": 1,
        "minor": -2,
        "patch": -3
      }
    }
  }
}

Limitations and assumptions

  • Component deltas are not a scalar distance or SemVer precedence comparison.
  • Version text is limited to 1,024 UTF-16 code units with no whitespace. Parsed core and numeric prerelease components must be nonnegative safe integers. Range expressions and a leading v are not accepted.
  • Every declared top-level input field is required and unexpected fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and no larger in absolute magnitude than the safe-integer limit; operations returning exact large integers use decimal text. Positions are zero-based and spans end exclusively unless the operation explicitly states a different convention.

Alternative or Complementary methods

Choose whether you need exact spelling, precedence or a release-lane grouping. Use a separate package manager or compatibility review for dependency resolution and release-policy decisions.

References

  1. Semantic Versioning 2.0.0 — Semantic Versioning

  2. Tool behavior and example: Semantic Version Core Component Distance — tool.io

Similar or alternative tools

  • Semantic Version Core Change Classifier

    Classify the highest differing SemVer core component and separately report full precedence comparison; component names do not prove semantic compatibility.

  • Semantic Version Core Record Extractor

    Extract strict SemVer core fields through the existing parser, bounded to safe integer components; no coercion of prefixes, whitespace or leading zeros.