View Source Moar.Version (Moar v1.62.0)

Version-related functions.

Summary

Functions

Like Version.compare/2 but first normalizes versions via normalize/1.

Adds major, minor, and patch versions if needed to create a string with major, minor, and patch numbers. Does not support versions that have anything other than numbers (like 1.2.3-beta4).

Functions

@spec compare(binary(), binary()) :: :gt | :eq | :lt

Like Version.compare/2 but first normalizes versions via normalize/1.

iex> Elixir.Version.compare("1.2", "1.2.3")
** (Version.InvalidVersionError) invalid version: "1.2"

iex> Moar.Version.compare("1.2", "1.2.3")
:lt
@spec normalize(binary()) :: binary()

Adds major, minor, and patch versions if needed to create a string with major, minor, and patch numbers. Does not support versions that have anything other than numbers (like 1.2.3-beta4).

iex> Moar.Version.normalize("1.2")
"1.2.0"