source: node_modules/semver/README.md@ 62b2964

finki-main main
Last change on this file since 62b2964 was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago

Initial commit

  • Property mode set to 100644
File size: 24.2 KB
Line 
1semver(1) -- The semantic versioner for npm
2===========================================
3
4## Install
5
6```bash
7npm install semver
8````
9
10## Usage
11
12As a node module:
13
14```js
15const semver = require('semver')
16
17semver.valid('1.2.3') // '1.2.3'
18semver.valid('a.b.c') // null
19semver.clean(' =v1.2.3 ') // '1.2.3'
20semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
21semver.gt('1.2.3', '9.8.7') // false
22semver.lt('1.2.3', '9.8.7') // true
23semver.minVersion('>=1.0.0') // '1.0.0'
24semver.valid(semver.coerce('v2')) // '2.0.0'
25semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
26```
27
28You can also just load the module for the function that you care about if
29you'd like to minimize your footprint.
30
31```js
32// load the whole API at once in a single object
33const semver = require('semver')
34
35// or just load the bits you need
36// all of them listed here, just pick and choose what you want
37
38// classes
39const SemVer = require('semver/classes/semver')
40const Comparator = require('semver/classes/comparator')
41const Range = require('semver/classes/range')
42
43// functions for working with versions
44const semverParse = require('semver/functions/parse')
45const semverValid = require('semver/functions/valid')
46const semverClean = require('semver/functions/clean')
47const semverInc = require('semver/functions/inc')
48const semverDiff = require('semver/functions/diff')
49const semverMajor = require('semver/functions/major')
50const semverMinor = require('semver/functions/minor')
51const semverPatch = require('semver/functions/patch')
52const semverPrerelease = require('semver/functions/prerelease')
53const semverCompare = require('semver/functions/compare')
54const semverRcompare = require('semver/functions/rcompare')
55const semverCompareLoose = require('semver/functions/compare-loose')
56const semverCompareBuild = require('semver/functions/compare-build')
57const semverSort = require('semver/functions/sort')
58const semverRsort = require('semver/functions/rsort')
59
60// low-level comparators between versions
61const semverGt = require('semver/functions/gt')
62const semverLt = require('semver/functions/lt')
63const semverEq = require('semver/functions/eq')
64const semverNeq = require('semver/functions/neq')
65const semverGte = require('semver/functions/gte')
66const semverLte = require('semver/functions/lte')
67const semverCmp = require('semver/functions/cmp')
68const semverCoerce = require('semver/functions/coerce')
69
70// working with ranges
71const semverSatisfies = require('semver/functions/satisfies')
72const semverMaxSatisfying = require('semver/ranges/max-satisfying')
73const semverMinSatisfying = require('semver/ranges/min-satisfying')
74const semverToComparators = require('semver/ranges/to-comparators')
75const semverMinVersion = require('semver/ranges/min-version')
76const semverValidRange = require('semver/ranges/valid')
77const semverOutside = require('semver/ranges/outside')
78const semverGtr = require('semver/ranges/gtr')
79const semverLtr = require('semver/ranges/ltr')
80const semverIntersects = require('semver/ranges/intersects')
81const semverSimplifyRange = require('semver/ranges/simplify')
82const semverRangeSubset = require('semver/ranges/subset')
83```
84
85As a command-line utility:
86
87```
88$ semver -h
89
90A JavaScript implementation of the https://semver.org/ specification
91Copyright Isaac Z. Schlueter
92
93Usage: semver [options] <version> [<version> [...]]
94Prints valid versions sorted by SemVer precedence
95
96Options:
97-r --range <range>
98 Print versions that match the specified range.
99
100-i --increment [<level>]
101 Increment a version by the specified level. Level can
102 be one of: major, minor, patch, premajor, preminor,
103 prepatch, prerelease, or release. Default level is 'patch'.
104 Only one version may be specified.
105
106--preid <identifier>
107 Identifier to be used to prefix premajor, preminor,
108 prepatch or prerelease version increments.
109
110-l --loose
111 Interpret versions and ranges loosely
112
113-n <0|1|false>
114 Base number for prerelease identifier (default: 0).
115 Use false to omit the number altogether.
116
117-p --include-prerelease
118 Always include prerelease versions in range matching
119
120-c --coerce
121 Coerce a string into SemVer if possible
122 (does not imply --loose)
123
124--rtl
125 Coerce version strings right to left
126
127--ltr
128 Coerce version strings left to right (default)
129
130Program exits successfully if any valid version satisfies
131all supplied ranges, and prints all satisfying versions.
132
133If no satisfying versions are found, then exits failure.
134
135Versions are printed in ascending order, so supplying
136multiple versions to the utility will just sort them.
137```
138
139## Versions
140
141A "version" is described by the `v2.0.0` specification found at
142<https://semver.org/>.
143
144A leading `"="` or `"v"` character is stripped off and ignored.
145Support for stripping a leading "v" is kept for compatibility with `v1.0.0` of the SemVer
146specification but should not be used anymore.
147
148## Ranges
149
150A `version range` is a set of `comparators` that specify versions
151that satisfy the range.
152
153A `comparator` is composed of an `operator` and a `version`. The set
154of primitive `operators` is:
155
156* `<` Less than
157* `<=` Less than or equal to
158* `>` Greater than
159* `>=` Greater than or equal to
160* `=` Equal. If no operator is specified, then equality is assumed,
161 so this operator is optional but MAY be included.
162
163For example, the comparator `>=1.2.7` would match the versions
164`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
165or `1.1.0`. The comparator `>1` is equivalent to `>=2.0.0` and
166would match the versions `2.0.0` and `3.1.0`, but not the versions
167`1.0.1` or `1.1.0`.
168
169Comparators can be joined by whitespace to form a `comparator set`,
170which is satisfied by the **intersection** of all of the comparators
171it includes.
172
173A range is composed of one or more comparator sets, joined by `||`. A
174version matches a range if and only if every comparator in at least
175one of the `||`-separated comparator sets is satisfied by the version.
176
177For example, the range `>=1.2.7 <1.3.0` would match the versions
178`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
179or `1.1.0`.
180
181The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
182`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
183
184### Prerelease Tags
185
186If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
187it will only be allowed to satisfy comparator sets if at least one
188comparator with the same `[major, minor, patch]` tuple also has a
189prerelease tag.
190
191For example, the range `>1.2.3-alpha.3` would be allowed to match the
192version `1.2.3-alpha.7`, but it would *not* be satisfied by
193`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
194than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
195range only accepts prerelease tags on the `1.2.3` version.
196Version `3.4.5` *would* satisfy the range because it does not have a
197prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
198
199The purpose of this behavior is twofold. First, prerelease versions
200frequently are updated very quickly, and contain many breaking changes
201that are (by the author's design) not yet fit for public consumption.
202Therefore, by default, they are excluded from range-matching
203semantics.
204
205Second, a user who has opted into using a prerelease version has
206indicated the intent to use *that specific* set of
207alpha/beta/rc versions. By including a prerelease tag in the range,
208the user is indicating that they are aware of the risk. However, it
209is still not appropriate to assume that they have opted into taking a
210similar risk on the *next* set of prerelease versions.
211
212Note that this behavior can be suppressed (treating all prerelease
213versions as if they were normal versions, for range-matching)
214by setting the `includePrerelease` flag on the options
215object to any
216[functions](https://github.com/npm/node-semver#functions) that do
217range matching.
218
219#### Prerelease Identifiers
220
221The method `.inc` takes an additional `identifier` string argument that
222will append the value of the string as a prerelease identifier:
223
224```javascript
225semver.inc('1.2.3', 'prerelease', 'beta')
226// '1.2.4-beta.0'
227```
228
229command-line example:
230
231```bash
232$ semver 1.2.3 -i prerelease --preid beta
2331.2.4-beta.0
234```
235
236Which then can be used to increment further:
237
238```bash
239$ semver 1.2.4-beta.0 -i prerelease
2401.2.4-beta.1
241```
242
243To get out of the prerelease phase, use the `release` option:
244
245```bash
246$ semver 1.2.4-beta.1 -i release
2471.2.4
248```
249
250#### Prerelease Identifier Base
251
252The method `.inc` takes an optional parameter 'identifierBase' string
253that will let you let your prerelease number as zero-based or one-based.
254Set to `false` to omit the prerelease number altogether.
255If you do not specify this parameter, it will default to zero-based.
256
257```javascript
258semver.inc('1.2.3', 'prerelease', 'beta', '1')
259// '1.2.4-beta.1'
260```
261
262```javascript
263semver.inc('1.2.3', 'prerelease', 'beta', false)
264// '1.2.4-beta'
265```
266
267command-line example:
268
269```bash
270$ semver 1.2.3 -i prerelease --preid beta -n 1
2711.2.4-beta.1
272```
273
274```bash
275$ semver 1.2.3 -i prerelease --preid beta -n false
2761.2.4-beta
277```
278
279### Advanced Range Syntax
280
281Advanced range syntax desugars to primitive comparators in
282deterministic ways.
283
284Advanced ranges may be combined in the same way as primitive
285comparators using white space or `||`.
286
287#### Hyphen Ranges `X.Y.Z - A.B.C`
288
289Specifies an inclusive set.
290
291* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
292
293If a partial version is provided as the first version in the inclusive
294range, then the missing pieces are replaced with zeroes.
295
296* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
297
298If a partial version is provided as the second version in the
299inclusive range, then all versions that start with the supplied parts
300of the tuple are accepted, but nothing that would be greater than the
301provided tuple parts.
302
303* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0-0`
304* `1.2.3 - 2` := `>=1.2.3 <3.0.0-0`
305
306#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
307
308Any of `X`, `x`, or `*` may be used to "stand in" for one of the
309numeric values in the `[major, minor, patch]` tuple.
310
311* `*` := `>=0.0.0` (Any non-prerelease version satisfies, unless
312 `includePrerelease` is specified, in which case any version at all
313 satisfies)
314* `1.x` := `>=1.0.0 <2.0.0-0` (Matching major version)
315* `1.2.x` := `>=1.2.0 <1.3.0-0` (Matching major and minor versions)
316
317A partial version range is treated as an X-Range, so the special
318character is in fact optional.
319
320* `""` (empty string) := `*` := `>=0.0.0`
321* `1` := `1.x.x` := `>=1.0.0 <2.0.0-0`
322* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0-0`
323
324#### Tilde Ranges `~1.2.3` `~1.2` `~1`
325
326Allows patch-level changes if a minor version is specified on the
327comparator. Allows minor-level changes if not.
328
329* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0-0`
330* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0-0` (Same as `1.2.x`)
331* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0-0` (Same as `1.x`)
332* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0-0`
333* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0-0` (Same as `0.2.x`)
334* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0-0` (Same as `0.x`)
335* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0-0` Note that prereleases in
336 the `1.2.3` version will be allowed, if they are greater than or
337 equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
338 `1.2.4-beta.2` would not, because it is a prerelease of a
339 different `[major, minor, patch]` tuple.
340
341#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
342
343Allows changes that do not modify the left-most non-zero element in the
344`[major, minor, patch]` tuple. In other words, this allows patch and
345minor updates for versions `1.0.0` and above, patch updates for
346versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
347
348Many authors treat a `0.x` version as if the `x` were the major
349"breaking-change" indicator.
350
351Caret ranges are ideal when an author may make breaking changes
352between `0.2.4` and `0.3.0` releases, which is a common practice.
353However, it presumes that there will *not* be breaking changes between
354`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
355additive (but non-breaking), according to commonly observed practices.
356
357* `^1.2.3` := `>=1.2.3 <2.0.0-0`
358* `^0.2.3` := `>=0.2.3 <0.3.0-0`
359* `^0.0.3` := `>=0.0.3 <0.0.4-0`
360* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0-0` Note that prereleases in
361 the `1.2.3` version will be allowed, if they are greater than or
362 equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
363 `1.2.4-beta.2` would not, because it is a prerelease of a
364 different `[major, minor, patch]` tuple.
365* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4-0` Note that prereleases in the
366 `0.0.3` version *only* will be allowed, if they are greater than or
367 equal to `beta`. So, `0.0.3-pr.2` would be allowed.
368
369When parsing caret ranges, a missing `patch` value desugars to the
370number `0`, but will allow flexibility within that value, even if the
371major and minor versions are both `0`.
372
373* `^1.2.x` := `>=1.2.0 <2.0.0-0`
374* `^0.0.x` := `>=0.0.0 <0.1.0-0`
375* `^0.0` := `>=0.0.0 <0.1.0-0`
376
377A missing `minor` and `patch` values will desugar to zero, but also
378allow flexibility within those values, even if the major version is
379zero.
380
381* `^1.x` := `>=1.0.0 <2.0.0-0`
382* `^0.x` := `>=0.0.0 <1.0.0-0`
383
384### Range Grammar
385
386Putting all this together, here is a Backus-Naur grammar for ranges,
387for the benefit of parser authors:
388
389```bnf
390range-set ::= range ( logical-or range ) *
391logical-or ::= ( ' ' ) * '||' ( ' ' ) *
392range ::= hyphen | simple ( ' ' simple ) * | ''
393hyphen ::= partial ' - ' partial
394simple ::= primitive | partial | tilde | caret
395primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
396partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
397xr ::= 'x' | 'X' | '*' | nr
398nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
399tilde ::= '~' partial
400caret ::= '^' partial
401qualifier ::= ( '-' pre )? ( '+' build )?
402pre ::= parts
403build ::= parts
404parts ::= part ( '.' part ) *
405part ::= nr | [-0-9A-Za-z]+
406```
407
408## Functions
409
410All methods and classes take a final `options` object argument. All
411options in this object are `false` by default. The options supported
412are:
413
414- `loose`: Be more forgiving about not-quite-valid semver strings.
415 (Any resulting output will always be 100% strict compliant, of
416 course.) For backwards compatibility reasons, if the `options`
417 argument is a boolean value instead of an object, it is interpreted
418 to be the `loose` param.
419- `includePrerelease`: Set to suppress the [default
420 behavior](https://github.com/npm/node-semver#prerelease-tags) of
421 excluding prerelease tagged versions from ranges unless they are
422 explicitly opted into.
423
424Strict-mode Comparators and Ranges will be strict about the SemVer
425strings that they parse.
426
427* `valid(v)`: Return the parsed version, or null if it's not valid.
428* `inc(v, releaseType, options, identifier, identifierBase)`:
429 Return the version incremented by the release
430 type (`major`, `premajor`, `minor`, `preminor`, `patch`,
431 `prepatch`, `prerelease`, or `release`), or null if it's not valid
432 * `premajor` in one call will bump the version up to the next major
433 version and down to a prerelease of that major version.
434 `preminor`, and `prepatch` work the same way.
435 * If called from a non-prerelease version, `prerelease` will work the
436 same as `prepatch`. It increments the patch version and then makes a
437 prerelease. If the input version is already a prerelease it simply
438 increments it.
439 * `release` will remove any prerelease part of the version.
440 * `identifier` can be used to prefix `premajor`, `preminor`,
441 `prepatch`, or `prerelease` version increments. `identifierBase`
442 is the base to be used for the `prerelease` identifier.
443* `prerelease(v)`: Returns an array of prerelease components, or null
444 if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
445* `major(v)`: Return the major version number.
446* `minor(v)`: Return the minor version number.
447* `patch(v)`: Return the patch version number.
448* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
449 or comparators intersect.
450* `parse(v)`: Attempt to parse a string as a semantic version, returning either
451 a `SemVer` object or `null`.
452
453### Comparison
454
455* `gt(v1, v2)`: `v1 > v2`
456* `gte(v1, v2)`: `v1 >= v2`
457* `lt(v1, v2)`: `v1 < v2`
458* `lte(v1, v2)`: `v1 <= v2`
459* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
460 even if they're not the same string. You already know how to
461 compare strings.
462* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
463* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
464 the corresponding function above. `"==="` and `"!=="` do simple
465 string comparison, but are included for completeness. Throws if an
466 invalid comparison string is provided.
467* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
468 `v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
469* `rcompare(v1, v2)`: The reverse of `compare`. Sorts an array of versions
470 in descending order when passed to `Array.sort()`.
471* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions
472 are equal. Sorts in ascending order if passed to `Array.sort()`.
473* `compareLoose(v1, v2)`: Short for `compare(v1, v2, { loose: true })`.
474* `diff(v1, v2)`: Returns the difference between two versions by the release type
475 (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
476 or null if the versions are the same.
477
478### Sorting
479
480* `sort(versions)`: Returns a sorted array of versions based on the `compareBuild`
481 function.
482* `rsort(versions)`: The reverse of `sort`. Returns an array of versions based on
483 the `compareBuild` function in descending order.
484
485### Comparators
486
487* `intersects(comparator)`: Return true if the comparators intersect
488
489### Ranges
490
491* `validRange(range)`: Return the valid range or null if it's not valid.
492* `satisfies(version, range)`: Return true if the version satisfies the
493 range.
494* `maxSatisfying(versions, range)`: Return the highest version in the list
495 that satisfies the range, or `null` if none of them do.
496* `minSatisfying(versions, range)`: Return the lowest version in the list
497 that satisfies the range, or `null` if none of them do.
498* `minVersion(range)`: Return the lowest version that can match
499 the given range.
500* `gtr(version, range)`: Return `true` if the version is greater than all the
501 versions possible in the range.
502* `ltr(version, range)`: Return `true` if the version is less than all the
503 versions possible in the range.
504* `outside(version, range, hilo)`: Return true if the version is outside
505 the bounds of the range in either the high or low direction. The
506 `hilo` argument must be either the string `'>'` or `'<'`. (This is
507 the function called by `gtr` and `ltr`.)
508* `intersects(range)`: Return true if any of the range comparators intersect.
509* `simplifyRange(versions, range)`: Return a "simplified" range that
510 matches the same items in the `versions` list as the range specified. Note
511 that it does *not* guarantee that it would match the same versions in all
512 cases, only for the set of versions provided. This is useful when
513 generating ranges by joining together multiple versions with `||`
514 programmatically, to provide the user with something a bit more
515 ergonomic. If the provided range is shorter in string-length than the
516 generated range, then that is returned.
517* `subset(subRange, superRange)`: Return `true` if the `subRange` range is
518 entirely contained by the `superRange` range.
519
520Note that, since ranges may be non-contiguous, a version might not be
521greater than a range, less than a range, *or* satisfy a range! For
522example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
523until `2.0.0`, so version `1.2.10` would not be greater than the
524range (because `2.0.1` satisfies, which is higher), nor less than the
525range (since `1.2.8` satisfies, which is lower), and it also does not
526satisfy the range.
527
528If you want to know if a version satisfies or does not satisfy a
529range, use the `satisfies(version, range)` function.
530
531### Coercion
532
533* `coerce(version, options)`: Coerces a string to semver if possible
534
535This aims to provide a very forgiving translation of a non-semver string to
536semver. It looks for the first digit in a string and consumes all
537remaining characters which satisfy at least a partial semver (e.g., `1`,
538`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer
539versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All
540surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
541`3.4.0`). Only text which lacks digits will fail coercion (`version one`
542is not valid). The maximum length for any semver component considered for
543coercion is 16 characters; longer components will be ignored
544(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any
545semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
546components are invalid (`9999999999999999.4.7.4` is likely invalid).
547
548If the `options.rtl` flag is set, then `coerce` will return the right-most
549coercible tuple that does not share an ending index with a longer coercible
550tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not
551`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of
552any other overlapping SemVer tuple.
553
554If the `options.includePrerelease` flag is set, then the `coerce` result will contain
555prerelease and build parts of a version. For example, `1.2.3.4-rc.1+rev.2`
556will preserve prerelease `rc.1` and build `rev.2` in the result.
557
558### Clean
559
560* `clean(version)`: Clean a string to be a valid semver if possible
561
562This will return a cleaned and trimmed semver version. If the provided
563version is not valid a null will be returned. This does not work for
564ranges.
565
566ex.
567* `s.clean(' = v 2.1.5foo')`: `null`
568* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'`
569* `s.clean(' = v 2.1.5-foo')`: `null`
570* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'`
571* `s.clean('=v2.1.5')`: `'2.1.5'`
572* `s.clean(' =v2.1.5')`: `'2.1.5'`
573* `s.clean(' 2.1.5 ')`: `'2.1.5'`
574* `s.clean('~1.0.0')`: `null`
575
576## Constants
577
578As a convenience, helper constants are exported to provide information about what `node-semver` supports:
579
580### `RELEASE_TYPES`
581
582- major
583- premajor
584- minor
585- preminor
586- patch
587- prepatch
588- prerelease
589
590```
591const semver = require('semver');
592
593if (semver.RELEASE_TYPES.includes(arbitraryUserInput)) {
594 console.log('This is a valid release type!');
595} else {
596 console.warn('This is NOT a valid release type!');
597}
598```
599
600### `SEMVER_SPEC_VERSION`
601
6022.0.0
603
604```
605const semver = require('semver');
606
607console.log('We are currently using the semver specification version:', semver.SEMVER_SPEC_VERSION);
608```
609
610## Exported Modules
611
612<!--
613TODO: Make sure that all of these items are documented (classes aren't,
614eg), and then pull the module name into the documentation for that specific
615thing.
616-->
617
618You may pull in just the part of this semver utility that you need if you
619are sensitive to packing and tree-shaking concerns. The main
620`require('semver')` export uses getter functions to lazily load the parts
621of the API that are used.
622
623The following modules are available:
624
625* `require('semver')`
626* `require('semver/classes')`
627* `require('semver/classes/comparator')`
628* `require('semver/classes/range')`
629* `require('semver/classes/semver')`
630* `require('semver/functions/clean')`
631* `require('semver/functions/cmp')`
632* `require('semver/functions/coerce')`
633* `require('semver/functions/compare')`
634* `require('semver/functions/compare-build')`
635* `require('semver/functions/compare-loose')`
636* `require('semver/functions/diff')`
637* `require('semver/functions/eq')`
638* `require('semver/functions/gt')`
639* `require('semver/functions/gte')`
640* `require('semver/functions/inc')`
641* `require('semver/functions/lt')`
642* `require('semver/functions/lte')`
643* `require('semver/functions/major')`
644* `require('semver/functions/minor')`
645* `require('semver/functions/neq')`
646* `require('semver/functions/parse')`
647* `require('semver/functions/patch')`
648* `require('semver/functions/prerelease')`
649* `require('semver/functions/rcompare')`
650* `require('semver/functions/rsort')`
651* `require('semver/functions/satisfies')`
652* `require('semver/functions/sort')`
653* `require('semver/functions/valid')`
654* `require('semver/ranges/gtr')`
655* `require('semver/ranges/intersects')`
656* `require('semver/ranges/ltr')`
657* `require('semver/ranges/max-satisfying')`
658* `require('semver/ranges/min-satisfying')`
659* `require('semver/ranges/min-version')`
660* `require('semver/ranges/outside')`
661* `require('semver/ranges/simplify')`
662* `require('semver/ranges/subset')`
663* `require('semver/ranges/to-comparators')`
664* `require('semver/ranges/valid')`
665
Note: See TracBrowser for help on using the repository browser.