diff options
Diffstat (limited to 'deps/npm/node_modules/semver/README.md')
-rw-r--r-- | deps/npm/node_modules/semver/README.md | 90 |
1 files changed, 53 insertions, 37 deletions
diff --git a/deps/npm/node_modules/semver/README.md b/deps/npm/node_modules/semver/README.md index cbd956549d..fd5151ab37 100644 --- a/deps/npm/node_modules/semver/README.md +++ b/deps/npm/node_modules/semver/README.md @@ -1,55 +1,65 @@ semver(1) -- The semantic versioner for npm =========================================== +## Install + +```bash +npm install --save semver +```` + ## Usage - $ npm install semver - $ node - var semver = require('semver') +As a node module: - semver.valid('1.2.3') // '1.2.3' - semver.valid('a.b.c') // null - 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 +```js +const semver = require('semver') + +semver.valid('1.2.3') // '1.2.3' +semver.valid('a.b.c') // null +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 +``` As a command-line utility: - $ semver -h +``` +$ semver -h - SemVer 5.1.0 +SemVer 5.3.0 - A JavaScript implementation of the http://semver.org/ specification - Copyright Isaac Z. Schlueter +A JavaScript implementation of the http://semver.org/ specification +Copyright Isaac Z. Schlueter - Usage: semver [options] <version> [<version> [...]] - Prints valid versions sorted by SemVer precedence +Usage: semver [options] <version> [<version> [...]] +Prints valid versions sorted by SemVer precedence - Options: - -r --range <range> - Print versions that match the specified range. +Options: +-r --range <range> + Print versions that match the specified range. - -i --increment [<level>] - Increment a version by the specified level. Level can - be one of: major, minor, patch, premajor, preminor, - prepatch, or prerelease. Default level is 'patch'. - Only one version may be specified. +-i --increment [<level>] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. - --preid <identifier> - Identifier to be used to prefix premajor, preminor, - prepatch or prerelease version increments. +--preid <identifier> + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. - -l --loose - Interpret versions and ranges loosely +-l --loose + Interpret versions and ranges loosely - Program exits successfully if any valid version satisfies - all supplied ranges, and prints all satisfying versions. +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. - If no satisfying versions are found, then exits failure. +If no satisfying versions are found, then exits failure. - Versions are printed in ascending order, so supplying - multiple versions to the utility will just sort them. +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them. +``` ## Versions @@ -126,20 +136,20 @@ The method `.inc` takes an additional `identifier` string argument that will append the value of the string as a prerelease identifier: ```javascript -> semver.inc('1.2.3', 'prerelease', 'beta') -'1.2.4-beta.0' +semver.inc('1.2.3', 'prerelease', 'beta') +// '1.2.4-beta.0' ``` command-line example: -```shell +```bash $ semver 1.2.3 -i prerelease --preid beta 1.2.4-beta.0 ``` Which then can be used to increment further: -```shell +```bash $ semver 1.2.4-beta.0 -i prerelease 1.2.4-beta.1 ``` @@ -296,6 +306,8 @@ strings that they parse. * `major(v)`: Return the major version number. * `minor(v)`: Return the minor version number. * `patch(v)`: Return the patch version number. +* `intersects(r1, r2, loose)`: Return true if the two supplied ranges + or comparators intersect. ### Comparison @@ -319,6 +331,9 @@ strings that they parse. (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), or null if the versions are the same. +### Comparators + +* `intersects(comparator)`: Return true if the comparators intersect ### Ranges @@ -337,6 +352,7 @@ strings that they parse. the bounds of the range in either the high or low direction. The `hilo` argument must be either the string `'>'` or `'<'`. (This is the function called by `gtr` and `ltr`.) +* `intersects(range)`: Return true if any of the ranges comparators intersect Note that, since ranges may be non-contiguous, a version might not be greater than a range, less than a range, *or* satisfy a range! For |