The >=
comparator is defined as you might expect:
>=
Greater than or equal to
Which has no maximum in its definition.
To add a max version number, one way would be to join it with another comparator via whitespace (e.g.
) to create a comparator set, which is
comparator set - satisfied by the intersection of all of the comparators it includes.
Let's say you wanted a version greater than or equal to 1.2.0
but less than 5.0.0
. Your full semver range would then be
>=1.2.0 <5.0.0
It is worth nothing that all ranges can be satisfied by primitive comparators (<
, <=
,>
, >=
, or =
), but libraries such as NPM allows for advanced range syntax that converts down to the primitive comparators in predictable ways. Here are some other examples you may find more useful, but again just note that you aren't bound by any specific syntax. You can use what you find most readable.
Hyphen Ranges X.Y.Z - A.B.C
1.2.3 - 2.3.4
→ >=1.2.3 <=2.3.4
X-Ranges 1.2.x
1.X
1.2.*
*
1.x
→ >=1.0.0 <2.0.0
Tilde Ranges ~1.2.3
~1.2
~1
~1.2.3
→ >=1.2.3 <1.3.0
Caret Ranges ^1.2.3
^0.2.5
^0.0.4
^1.2.3
→ >=1.2.3 <2.0.0