Skip to content

Commit a3bbb41

Browse files
authored
Add function that produces a range from an exact version (#702)
1 parent 825d02b commit a3bbb41

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/src/Range.purs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
module Registry.Range
55
( Range
66
, caret
7+
, exact
78
, codec
89
, greaterThanOrEq
910
, includes
@@ -147,6 +148,11 @@ mk lhs rhs | lhs < rhs = Just (Range { lhs, rhs })
147148
mk _ _ = Nothing
148149

149150
-- | Produce a "caret range" from a version.
150-
-- | I.e. "^0.15.6" ==> ">=0.15.6 > 0.16.0"
151+
-- | I.e. "^0.15.6" ==> ">=0.15.6 <0.16.0"
151152
caret :: Version -> Range
152153
caret v = Range { lhs: v, rhs: Version.bumpHighest v }
154+
155+
-- | Produce a range that only covers an exact version.
156+
-- | I.e. "0.15.6" ==> ">=0.15.6 <0.15.7"
157+
exact :: Version -> Range
158+
exact v = Range { lhs: v, rhs: Version.bumpPatch v }

0 commit comments

Comments
 (0)