-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reference: #22688 To support re-ordering the elements of a given list of strings so that the elements matching a given version constraint are returned in precedence order.
- Loading branch information
Showing
7 changed files
with
292 additions
and
1 deletion.
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
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
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,27 @@ | ||
--- | ||
layout: "functions" | ||
page_title: "sortsemver - Functions - Configuration Language" | ||
sidebar_current: "docs-funcs-collection-sortsemver" | ||
description: |- | ||
The sortsemver function takes a version constraint string and a list of | ||
semantic version strings and returns the versions matching that constraint in | ||
precedence order. | ||
--- | ||
|
||
# `sortsemver` Function | ||
|
||
`sortsemver` takes a [version constraint string](/docs/language/expressions/version-constraints.html) | ||
and a list of semantic version strings and returns the versions matching that | ||
constraint in precedence order. A valid semantic version string is described | ||
by the v2.0.0 specification. An empty version constraint string will | ||
successfully match all versions. | ||
|
||
## Examples | ||
|
||
``` | ||
> sortsemver("~> 1.2.0", ["1.0.0", "1.2.4", "1.4.0-5", "1.2.3"]) | ||
[ | ||
"1.2.3", | ||
"1.2.4", | ||
] | ||
``` |
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