diff options
author | Rebecca Turner <me@re-becca.org> | 2018-02-20 08:52:15 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2018-02-21 00:48:24 +0300 |
commit | 51370aad561b368ccc95c1c935c67c8cd2844d40 (patch) | |
tree | 9d7e1c239735a1c692de83587b031569705ab889 /node_modules/semver/README.md | |
parent | 9b6bdb2c77e49f6d473e70de4cd83c58d7147965 (diff) |
semver@5.5.0
Credit: @isaacs
Diffstat (limited to 'node_modules/semver/README.md')
-rw-r--r-- | node_modules/semver/README.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/node_modules/semver/README.md b/node_modules/semver/README.md index fd5151ab3..951c53956 100644 --- a/node_modules/semver/README.md +++ b/node_modules/semver/README.md @@ -20,6 +20,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' ``` As a command-line utility: @@ -52,6 +54,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. @@ -364,3 +370,19 @@ satisfy the range. If you want to know if a version satisfies or does not satisfy a range, use the `satisfies(version, range)` function. + +### Coercion + +* `coerce(version)`: Coerces a string to semver if possible + +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., `1`, `1.2`, `1.2.3`) up to the max permitted length (256 characters). +Longer versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). +All surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes `3.4.0`). +Only text which lacks digits will fail coercion (`version one` is not valid). +The maximum length for any semver component considered for coercion is 16 characters; +longer components will be ignored (`10000000000000000.4.7.4` becomes `4.7.4`). +The maximum value for any semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; +higher value components are invalid (`9999999999999999.4.7.4` is likely invalid). |