API reference
GD.version
Entry for parsing, comparing, and range-matching Semantic Versions.
Methods
parse(raw: String) -> Dictionary, Erris_canonical(raw: String) -> boolcompare(a: Dictionary, b: Dictionary) -> intis_stable(v: Dictionary) -> booltext(v: Dictionary) -> Stringbest(list: PackedStringArray, range: String = "*") -> Dictionary, Errbest_async(list: PackedStringArray, range: String = "*") -> await Dictionary, Errsatisfies(v: Dictionary, range: String) -> bool
parse
parse(raw: String) -> Dictionary, ErrParse version text into a component dictionary.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
raw | String | Required | Semantic-version text to parse or validate. |
Return value
Dictionary, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
is_canonical
is_canonical(raw: String) -> boolRequire a complete semantic version suitable for packages.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
raw | String | Required | Semantic-version text to parse or validate. |
Return value
bool
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
compare
compare(a: Dictionary, b: Dictionary) -> intCompare two versions.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
a | Dictionary | Required | First semantic-version string. |
b | Dictionary | Required | Second semantic-version string. |
Return value
int
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
is_stable
is_stable(v: Dictionary) -> boolCheck whether a version is not a prerelease.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
v | Dictionary | Required | Version value to format or test. |
Return value
bool
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
text
text(v: Dictionary) -> StringFormat a version dictionary as text.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
v | Dictionary | Required | Version value to format or test. |
Return value
String
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
best
best(list: PackedStringArray, range: String = "*") -> Dictionary, ErrSelect the newest version within a range.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
list | PackedStringArray | Required | Candidate versions from which a matching version is selected. |
range | String | "*" | Version constraint to test against, rather than a numeric interval. |
Return value
Dictionary, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
best_async
best_async(list: PackedStringArray, range: String = "*") -> await Dictionary, ErrDispatch selection from large version lists to a CPU worker.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
list | PackedStringArray | Required | Candidate versions from which a matching version is selected. |
range | String | "*" | Version constraint to test against, rather than a numeric interval. |
Return value
await Dictionary, Err
Returns a Signal. Use await to receive the completion value shown in the signature.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
satisfies
satisfies(v: Dictionary, range: String) -> boolCheck whether a version satisfies a range.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
v | Dictionary | Required | Version value to format or test. |
range | String | Required | Version constraint to test against, rather than a numeric interval. |
Return value
bool
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.