Skip to content

Commit c5d29df

Browse files
hcharleywraithgar
authored andcommitted
docs: Add "Constants" section to README
documents `RELEASE_TYPES` and `SEMVER_SPEC_VERSION`
1 parent 48d8f8f commit c5d29df

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,40 @@ ex.
513513
* `s.clean(' 2.1.5 ')`: `'2.1.5'`
514514
* `s.clean('~1.0.0')`: `null`
515515
516+
## Constants
517+
518+
As a convenience, helper constants are exported to provide information about what `node-semver` supports:
519+
520+
### `RELEASE_TYPES`
521+
522+
- major
523+
- premajor
524+
- minor
525+
- preminor
526+
- patch
527+
- prepatch
528+
- prerelease
529+
530+
```
531+
const semver = require('semver');
532+
533+
if (semver.RELEASE_TYPES.includes(arbitraryUserInput)) {
534+
console.log('This is a valid release type!');
535+
} else {
536+
console.warn('This is NOT a valid release type!');
537+
}
538+
```
539+
540+
### `SEMVER_SPEC_VERSION`
541+
542+
2.0.0
543+
544+
```
545+
const semver = require('semver');
546+
547+
console.log('We are currently using the semver specification version:', semver.SEMVER_SPEC_VERSION);
548+
```
549+
516550
## Exported Modules
517551
518552
<!--
@@ -566,3 +600,4 @@ The following modules are available:
566600
* `require('semver/ranges/outside')`
567601
* `require('semver/ranges/to-comparators')`
568602
* `require('semver/ranges/valid')`
603+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy