Skip to main content

Parsing and comparing of semantic versions (SemVer)

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
94%
Published
3 days ago (1.0.4)

default

The Semantic Version parser.

f
canParse

Returns true if the string can be parsed as SemVer.

I
Comparator

The shape of a valid SemVer comparator.

f
compare

Compare two SemVers.

f
difference

Returns difference between two SemVers by the release type, or undefined if the SemVers are the same.

f
equals

Returns true if both SemVers are equivalent.

f
format

Format a SemVer object into a string.

f
formatRange

Formats the SemVerrange into a string.

f
greaterOrEqual

Greater than or equal to comparison for two SemVers.

f
greaterThan

Greater than comparison for two SemVers.

f
greaterThanRange

Check if the SemVer is greater than the range.

f
increment

Returns the new SemVer resulting from an increment by release type.

I
IncrementOptions

Options for increment.

f
isRange

Does a deep check on the object to determine if its a valid range.

f
isSemVer

Checks to see if value is a valid SemVer object. It does a check into each field including prerelease and build.

f
lessOrEqual

Less than or equal to comparison for two SemVers.

f
lessThan

Less than comparison for two SemVers.

f
lessThanRange

Check if the SemVer is less than the range.

f
maxSatisfying

Returns the highest SemVer in the list that satisfies the range, or undefined if none of them do.

f
minSatisfying

Returns the lowest SemVer in the list that satisfies the range, or undefined if none of them do.

f
notEquals

Not equal comparison for two SemVers.

T
Operator

SemVer comparison operators.

f
parse

Attempt to parse a string as a semantic version, returning a SemVer object.

f
parseRange

Parses a range string into a Range object.

T
Range

A type representing a semantic version range. The ranges consist of a nested array, which represents a set of OR comparisons while the inner array represents AND comparisons.

f
rangeIntersects

The ranges intersect every range of AND comparators intersects with a least one range of OR ranges.

T
ReleaseType

The possible release types are used as an operator for the increment function and as a result of the difference function.

f
satisfies

Test to see if the SemVer satisfies the range.

I
SemVer

A SemVer object parsed into its constituent parts.

f
tryParse

Returns the parsed SemVer, or undefined if it's not valid.

f
tryParseRange

Parses the given range string and returns a Range object. If the range string is invalid, undefined is returned.

f
canParse

Returns true if the string can be parsed as SemVer.

f
compare

Compare two SemVers.

f
difference

Returns difference between two SemVers by the release type, or undefined if the SemVers are the same.

f
equals

Returns true if both SemVers are equivalent.

f
format

Format a SemVer object into a string.

f
formatRange

Formats the SemVerrange into a string.

f
greaterOrEqual

Greater than or equal to comparison for two SemVers.

f
greaterThan

Greater than comparison for two SemVers.

f
greaterThanRange

Check if the SemVer is greater than the range.

f
increment

Returns the new SemVer resulting from an increment by release type.

I
IncrementOptions

Options for increment.

f
isRange

Does a deep check on the object to determine if its a valid range.

f
isSemVer

Checks to see if value is a valid SemVer object. It does a check into each field including prerelease and build.

f
lessOrEqual

Less than or equal to comparison for two SemVers.

f
lessThan

Less than comparison for two SemVers.

f
lessThanRange

Check if the SemVer is less than the range.

f
maxSatisfying

Returns the highest SemVer in the list that satisfies the range, or undefined if none of them do.

f
minSatisfying

Returns the lowest SemVer in the list that satisfies the range, or undefined if none of them do.

f
notEquals

Not equal comparison for two SemVers.

f
parse

Attempt to parse a string as a semantic version, returning a SemVer object.

f
parseRange

Parses a range string into a Range object.

f
rangeIntersects

The ranges intersect every range of AND comparators intersects with a least one range of OR ranges.

f
satisfies

Test to see if the SemVer satisfies the range.

f
tryParse

Returns the parsed SemVer, or undefined if it's not valid.

f
tryParseRange

Parses the given range string and returns a Range object. If the range string is invalid, undefined is returned.

I
Comparator

The shape of a valid SemVer comparator.

T
Operator

SemVer comparison operators.

T
Range

A type representing a semantic version range. The ranges consist of a nested array, which represents a set of OR comparisons while the inner array represents AND comparisons.

T
ReleaseType

The possible release types are used as an operator for the increment function and as a result of the difference function.

I
SemVer

A SemVer object parsed into its constituent parts.