-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update docs with the newly added feature (i.e.
DecVer
)
- Loading branch information
Showing
8 changed files
with
222 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"label": "DecVer", | ||
"position": 3, | ||
"collapsible": true, | ||
"collapsed": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
|
||
# DecVer (Decimal Version) | ||
|
||
## `DecVer.parse` | ||
|
||
```scala mdoc:reset-object | ||
import just.decver.DecVer | ||
|
||
val v = DecVer.parse("1.0") | ||
|
||
// To render it to `String`, | ||
v.map(_.render) | ||
|
||
// Invalid version | ||
DecVer.parse("a1.0") | ||
|
||
// Invalid version | ||
DecVer.parse("a1.0.0") | ||
|
||
``` | ||
|
||
## `DecVer.unsafeParse` | ||
|
||
```scala mdoc:reset-object | ||
import just.decver.DecVer | ||
|
||
// parse unsafe - NOT RECOMMENDED!!! | ||
val v = DecVer.unsafeParse("1.0") | ||
|
||
// to String | ||
v.render | ||
``` | ||
|
||
```scala mdoc:crash | ||
|
||
// Invalid version | ||
DecVer.unsafeParse("a1.0") | ||
``` | ||
|
||
## DecVer with `pre-release` info | ||
```scala mdoc:reset-object | ||
import just.decver.DecVer | ||
|
||
DecVer.parse("1.0-beta1") | ||
|
||
val v = DecVer.parse("1.0-3.123.9a") | ||
|
||
v.map(_.render) | ||
``` | ||
|
||
## DecVer with build `meta-info` | ||
```scala mdoc:reset-object | ||
import just.decver.DecVer | ||
|
||
val v = DecVer.parse("1.0+100.0.12abc") | ||
|
||
v.map(_.render) | ||
``` | ||
|
||
## DecVer with `pre-release` info and build `meta-info` | ||
```scala mdoc:reset-object | ||
import just.decver.DecVer | ||
|
||
DecVer.parse("1.0-beta1") | ||
|
||
val v = DecVer.parse("1.0-3.123.9a+100.0.12abc") | ||
|
||
v.map(_.render) | ||
``` | ||
|
||
## Compare `DecVer` | ||
```scala mdoc:reset-object | ||
import just.decver.DecVer | ||
|
||
for { | ||
a <- DecVer.parse("1.0") | ||
b <- DecVer.parse("1.1") | ||
} yield a < b | ||
|
||
for { | ||
a <- DecVer.parse("1.1") | ||
b <- DecVer.parse("1.0") | ||
} yield a < b | ||
|
||
for { | ||
a <- DecVer.parse("1.0") | ||
b <- DecVer.parse("1.1") | ||
} yield a <= b | ||
|
||
for { | ||
a <- DecVer.parse("1.0") | ||
b <- DecVer.parse("1.0") | ||
} yield a <= b | ||
|
||
for { | ||
a <- DecVer.parse("1.0") | ||
b <- DecVer.parse("1.0") | ||
} yield a == b | ||
|
||
for { | ||
a <- DecVer.parse("1.1") | ||
b <- DecVer.parse("1.0") | ||
} yield a > b | ||
|
||
for { | ||
a <- DecVer.parse("1.0") | ||
b <- DecVer.parse("1.1") | ||
} yield a > b | ||
|
||
for { | ||
a <- DecVer.parse("1.0") | ||
b <- DecVer.parse("1.1") | ||
} yield a >= b | ||
|
||
for { | ||
a <- DecVer.parse("1.0") | ||
b <- DecVer.parse("1.0") | ||
} yield a >= b | ||
|
||
for { | ||
a <- DecVer.parse("1.1") | ||
b <- DecVer.parse("1.0") | ||
} yield a >= b | ||
``` | ||
|
||
## Matchers | ||
```scala mdoc | ||
DecVer.unsafeParse("1.0").unsafeMatches("1.0 - 2.0") | ||
DecVer.unsafeParse("1.5").unsafeMatches("1.0 - 2.0") | ||
DecVer.unsafeParse("2.0").unsafeMatches("1.0 - 2.0") | ||
DecVer.unsafeParse("0.9").unsafeMatches("1.0 - 2.0") | ||
DecVer.unsafeParse("2.1").unsafeMatches("1.0 - 2.0") | ||
|
||
DecVer.unsafeParse("1.0").unsafeMatches(">1.0 <2.0") | ||
DecVer.unsafeParse("1.0").unsafeMatches(">=1.0 <=2.0") | ||
DecVer.unsafeParse("1.5").unsafeMatches(">1.0 <2.0") | ||
DecVer.unsafeParse("2.0").unsafeMatches(">1.0 <2.0") | ||
DecVer.unsafeParse("2.0").unsafeMatches(">=1.0 <=2.0") | ||
DecVer.unsafeParse("0.9").unsafeMatches(">=1.0 <=2.0") | ||
DecVer.unsafeParse("2.1").unsafeMatches(">=1.0 <=2.0") | ||
|
||
DecVer.unsafeParse("1.0").unsafeMatches("1.0 - 2.0 || >3.0 <4.0") | ||
DecVer.unsafeParse("2.0").unsafeMatches("1.0 - 2.0 || >3.0 <4.0") | ||
DecVer.unsafeParse("3.0").unsafeMatches("1.0 - 2.0 || >3.0 <=4.0") | ||
DecVer.unsafeParse("3.1").unsafeMatches("1.0 - 2.0 || >3.0 <=4.0") | ||
DecVer.unsafeParse("4.0").unsafeMatches("1.0 - 2.0 || >3.0 <=4.0") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"label": "How to use", | ||
"label": "SemVer", | ||
"position": 2, | ||
"collapsible": true, | ||
"collapsed": false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters