diff options
Diffstat (limited to 'deps/npm/man/man7/semver.7')
-rw-r--r-- | deps/npm/man/man7/semver.7 | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/deps/npm/man/man7/semver.7 b/deps/npm/man/man7/semver.7 index 23c1e018d5..dcb3b0f330 100644 --- a/deps/npm/man/man7/semver.7 +++ b/deps/npm/man/man7/semver.7 @@ -1,4 +1,4 @@ -.TH "SEMVER" "7" "December 2017" "" "" +.TH "SEMVER" "7" "May 2018" "" "" .SH "NAME" \fBsemver\fR \- The semantic versioner for npm .SH Install @@ -23,6 +23,8 @@ semver\.clean(' =v1\.2\.3 ') // '1\.2\.3' semver\.satisfies('1\.2\.3', '1\.x || >=2\.5\.0 || 5\.0\.0 \- 7\.2\.3') // true semver\.gt('1\.2\.3', '9\.8\.7') // false semver\.lt('1\.2\.3', '9\.8\.7') // true +semver\.valid(semver\.coerce('v2')) // '2\.0\.0' +semver\.valid(semver\.coerce('42\.6\.7\.9\.3\-alpha')) // '42\.6\.7' .fi .RE .P @@ -57,6 +59,10 @@ Options: \-l \-\-loose Interpret versions and ranges loosely +\-c \-\-coerce + Coerce a string into SemVer if possible + (does not imply \-\-loose) + Program exits successfully if any valid version satisfies all supplied ranges, and prints all satisfying versions\. @@ -455,4 +461,22 @@ satisfy the range\. .P If you want to know if a version satisfies or does not satisfy a range, use the \fBsatisfies(version, range)\fP function\. +.SS Coercion +.RS 0 +.IP \(bu 2 +\fBcoerce(version)\fP: Coerces a string to semver if possible + +.RE +.P +This aims to provide a very forgiving translation of a non\-semver +string to semver\. It looks for the first digit in a string, and +consumes all remaining characters which satisfy at least a partial semver +(e\.g\., \fB1\fP, \fB1\.2\fP, \fB1\.2\.3\fP) up to the max permitted length (256 characters)\. +Longer versions are simply truncated (\fB4\.6\.3\.9\.2\-alpha2\fP becomes \fB4\.6\.3\fP)\. +All surrounding text is simply ignored (\fBv3\.4 replaces v3\.3\.1\fP becomes \fB3\.4\.0\fP)\. +Only text which lacks digits will fail coercion (\fBversion one\fP is not valid)\. +The maximum length for any semver component considered for coercion is 16 characters; +longer components will be ignored (\fB10000000000000000\.4\.7\.4\fP becomes \fB4\.7\.4\fP)\. +The maximum value for any semver component is \fBInteger\.MAX_SAFE_INTEGER || (2**53 \- 1)\fP; +higher value components are invalid (\fB9999999999999999\.4\.7\.4\fP is likely invalid)\. |