NPM.VersionRange (NPM v0.6.0)

Copy Markdown View Source

Advanced version range manipulation.

Extends NPMSemver with range intersection, union, and analysis operations.

Summary

Functions

Classifies a range by type.

Checks if two ranges can be satisfied by the same version.

Returns a human-readable description of a range.

Checks if a range is exact (pinned to a single version).

Extracts the major version from a range (for caret ranges).

Finds the highest version that satisfies a range from a list.

Finds the lowest version that satisfies a range from a list.

Functions

classify(range)

@spec classify(String.t()) :: atom()

Classifies a range by type.

compatible?(range_a, range_b)

@spec compatible?(String.t(), String.t()) :: boolean()

Checks if two ranges can be satisfied by the same version.

describe(range)

@spec describe(String.t()) :: String.t()

Returns a human-readable description of a range.

exact?(range)

@spec exact?(String.t()) :: boolean()

Checks if a range is exact (pinned to a single version).

major(range)

@spec major(String.t()) :: non_neg_integer() | nil

Extracts the major version from a range (for caret ranges).

max_satisfying(versions, range)

@spec max_satisfying([String.t()], String.t()) :: String.t() | nil

Finds the highest version that satisfies a range from a list.

min_satisfying(versions, range)

@spec min_satisfying([String.t()], String.t()) :: String.t() | nil

Finds the lowest version that satisfies a range from a list.